Made an image for better understanding of the problem.
Need code for .bgimage and .content div
Is this even possible for crossbrowser css (IE7+ and other major browsers) without any scripting?
Made an image for better understanding of the problem.
Need code for .bgimage and .content div
Is this even possible for crossbrowser css (IE7+ and other major browsers) without any scripting?
它实际上比预期的要长一点,但我在现实生活中得到了你的照片。在没有先做更多研究并编写一些实际代码的情况下,不要在这里再问任何问题。
HTML:
<body>
<div id = "header">
</div>
<div id = "bgimage">
</div>
<div id = "content">
</div>
<span class = "clear"></span>
<div id = "footer">
</div>
</body>
CSS:
*
{
margin: 0;
padding: 0;
}
body
{
width: 960px;
margin-left: auto;
margin-right: auto;
}
#header
{
width: 100%;
height: 200px;
background-color: purple;
}
#bgimage
{
position: absolute;
top: 200px;
left: 0px;
right: 50%;
height: 600px;
background-color: green;
}
#content
{
position: relative;
width: 700px;
height: 600px;
float: right;
z-index: 2;
background-color: blue;
}
.clear
{
clear: both;
}
#footer
{
position: relative;
top: 600px;
width: 100%;
height: 200px;
background-color: red;
}
注意:我还没有优化 CSS,有一些工作可以在那里完成。
我在代码中使用的元素(你可能想用谷歌搜索):