大家好,我对div
width:auto
的某些问题感到疑惑。
这是HTML:
<div class="greenMenu">
<div class="btn">
<img src="img/image.png" width="57" height="46" />
<div class="area">
<div class="txt">A Lorem ipsum</div>
</div>
</div>
<div class="btn">
<img src="img/image.png" width="57" height="46" />
<div class="area">
<div class="txt">A Lorem ipsum</div>
</div>
</div>
</div>
和CSS:
.greenMenu {
position:absolute;
top:83px;
left:220px;
width:auto;
height:47px;
background:url(../img/prod-uova-ripMenu.png) left top repeat;
}
.greenMenu .btn {
background:#090;
float:left;
margin-top:1px;
margin-left:6px;
*display:inline;
_display:inline;
width:auto;
height:43px;
position:relative;
}
.greenMenu .btn img {
border:none;
position:absolute;
top:0px;
left:0px;
z-index:2;
}
.greenMenu .btn .area {
background:#53882d;
width:auto;
height:32px;
position:absolute;
top:5px;
left:0px;
z-index:1;
}
.greenMenu .btn .area .txt {
float:left;
margin:7px 13px 0 60px;
}
问题是:greenMenu
无法扩展其宽度,同时div.btn
宽度为0。
答案 0 :(得分:0)
不要在那里使用以下代码:
position: absolute;