我有一个包含三个嵌套 Div 的父 Div。现在根据我的要求,我必须添加父 Div 的背景图像,所有其他子部分都应该在它下面,但父 Div 背景图像显示在一半父 Div 而我想显示完整的父 Div。我没有得到我所缺少的。
这是我的 HTML..
<div id="innerbody" class="inner-body">
//First Div
<div id="tele" style="margin-left:auto; margin-right:auto; width:1080px; height:325px;">
<div id="telec" style="position:inherit; float:left; width:180px; height:325px;">
<p style="padding-top:20px;">
<br /><br /><br /><br /><br />
Telecommunication</p>
</div>
<div id="teledesc" style="position:inherit; width:870px; margin-top:20px; height:325px; float:left;">
</div>
</div>
</div>
//Second and Third Div like this
</div>
这是我的CSS..
.inner-body
{
margin-left:auto;
margin-right:auto;
width:100%;
height:1350px;
margin-top:-20px;
font-size:18px;
color: #6c3f00;
background: url('../img/new_images/innerbody_bg.jpg') center center no-repeat;
background-size: 100%;
}
请帮帮我..谢谢
最佳答案
我认为您的问题不够清楚,也没有提供 fiddle ,但您的意思是这样吗?
如果是,将其添加到类 .inner-body
中:
display: table;
width: 100%;
background: url('../img/new_images/innerbody_bg.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
关于html - 背景图像未以完整 Div 显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25243627/