Recently in practice, it is increasingly felt that the LI element contains a IMG elements of the time will be more trouble, need to pay attention, of course, the problem is still the same as in IE
Recently in practice, it is increasingly felt that the LI element contains a IMG elements of the time will be more trouble, need to pay attention, of course, the problem is the same as always appear in IE. Here is one example:
Html
<ul>
<li><a href=http://www.blue1000.com/wschool/wdesign/css/20090611/></a></li>
<li><a href=http://www.blue1000.com/wschool/wdesign/css/20090611/></a></li>
<li><a href=http://www.blue1000.com/wschool/wdesign/css/20090611/></a></li>
<li><a href=http://www.blue1000.com/wschool/wdesign/css/20090611/></a></li>
</ul>
Css
ul{
width:280px;
}
UL li{
Display:block;
height:57px;
width:277px;
}
Where temp.jpg size is 277x57
The normal performance under Firefox:
Abnormal performance under IE6:
It is obvious that IE, Li's performance height, not the 57px we set, but higher than it, this is because the img below more than 5px blank. --> -->
Make Li float, and set IMG as block-level elements
ul{
width:280px;
}
UL li{
Float:left;
Display:block;
height:57px;
width:277px;
}
img{
Display:block;
}
Workaround Two
Set up the UL font-size:0;
ul{
width:280px;
font-size:0;
}
UL li{
Display:block;
height:57px;
width:277px;
}
Workaround Three
Set up the Vertical-align:bottom of IMG;
ul{
width:280px;
font-size:0;
}
UL li{
Display:block;
height:57px;
width:277px;
}
img{
Vertical-align:bottom;
}
Workaround Four
Set up the IMG margin-bottom: -5px;
ul{
width:280px;
font-size:0;
}
UL li{
Display:block;
height:57px;
width:277px;
}
img{
Margin-bottom: -5px;
}