如果不使用绝对坐标,也就是相对定位,就可以将div与CSS重叠吗?
我有一个背景图像,我分成三个垂直的部分,
。
然后我想让我的主要网站内容在上面,居中。我不知道如何在不使用绝对定位的情况下做到这一点。
Kinda like this
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|
|$$$$$|----------------------|&&&&&|
|$$$$$| |&&&&&|
|$$$$$| |&&&&&|
|$$$$$|shakeyour<body></body>|&&&&&|
|$$$$$| |&&&&&|
|$$$$$| |&&&&&|
|$$$$$|----------------------|&&&&&|
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|
Different symbols = differnt background image or pattern我想把背景设为3div,然后把身体div定位在绝对位置上,但我想让它以宽屏显示器为中心。有什么想法吗?
For example, the expected behavior under resizing:
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|
|$$$|--------------------------|&&&|
|$$$| |&&&|
|$$$| |&&&|
|$$$| shakeyour<body></body> |&&&|
|$$$| |&&&|
|$$$| |&&&|
|$$$|--------------------------|&&&|
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|
---
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|
|$|------------------------------|&|
|$| |&|
|$| |&|
|$| shakeyour<body></body> |&|
|$| |&|
|$| |&|
|$|------------------------------|&|
|$$$$$|**********************|&&&&&|
|$$$$$|**********************|&&&&&|发布于 2012-11-19 09:53:11
body {
padding: 50px 20px;
box-sizing: border-box;
}发布于 2010-12-31 08:30:42
<div style="float: left; width: 20%;">Left</div>
<div style="float: left; width: 60%; margin: 0 20%;">Center</div>
<div style="float: right; width: 20%;">Right</div>你需要这样的东西。当然,在CSS文件中移动样式,并添加您的背景。
https://stackoverflow.com/questions/4568968
复制相似问题