5 pixel Blank solution for IE under img

Source: Internet
Author: User
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;
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.