参见英文答案 >
css background color with floating elements4个
这段代码有什么问题?
当我添加float:left到#text和#text2时,背景消失在div后面.但当我移除浮子时:左,一切看起来都不错.
/p>
"http://www.w3.org/TR/html4/loose.dtd">
#first{
width: 200px;
background-color: #345752;
}
#left_b{
background:transparent url('img/left.png');
background-position: left top;
background-repeat: repeat-y;
min-height: 30px;
}
#right_b{
background:transparent url('img/right.png');
background-position: right top;
background-repeat: repeat-y;
}
#text{
float: left;
width: 50px;
height: 30px;
}
#text2{
float: left;
width: 70px;
height: 30px;
}
text 1
text 2