【发布时间】:2017-04-30 09:41:04
【问题描述】:
我在 DIV 中有一个图像。 我想将图像“悬垂”在 DIV 之外一点,所以我将其定位为绝对,父容器定位为相对。当我这样做时,父 DIV 不再调整其高度以包含图像。 我该怎么做?
HTML
<div class=".twelve.columns" id="header">
<div id="logoWrapper">
<img src="https://nbson.com/sni/images/logo.png" class="ssImg">
<div class="clr"></div>
</div>
</div>
CSS
.ssImg{
width:100%;
}
.clr{
clear:both;
}
#header{
margin-top:0;
background:#000;
position:relative;
width:100%;
border:1pt solid pink;
}
【问题讨论】:
-
如果你想在一个元素上放置两个类,使用
<div class="twelve columns">,而不是<div class=".twelve.columns">。