就是我在一个div里放了一些span,并据对定位,最后也清除了浮动,可是为什么div没有撑开。
html
<div class="test">
<span>111</span><span>111</span><span>111</span><span>111</span><span>111</span>
</div>
css
.test {
position: relative;
background-color: white;
.clearfix();
span {
font-size: 14px;
color: #000;
position: absolute;
&:first-child{
left: 0;
}
&:nth-child(2){
left: 50px;
}
&:nth-child(3){
left: 100px;
}
&:nth-child(4){
left: 150px;
}
&:nth-child(5){
left: 200px;
}
}
}
我脑子抽了。。。。float才有用,现在是绝对定位。。。。不好意思。。。脑子抽了
高度的问题吧 你试试加上height