IMG in IE6 is 5 pixels Blank

Source: Internet
Author: User
Code


< Ul >
< Li > < A href = " # " > < IMG SRC = " IMG/temp.jpg " ALT = ""   / > < / A > < / LI>
< Li > < A href = " # " > < IMG SRC = " IMG/temp.jpg " ALT = ""   / > < / A > < / LI>
< Li > < A href = " # " > < IMG SRC = " IMG/temp.jpg " ALT = ""   / > < / A > < / LI>
< Li > < A href = " # " > < IMG SRC = " IMG/temp.jpg " ALT = ""   / > < / A > < / LI>
< / Ul>

Ul {
Width: 280px;
}
Ul Li {
Display: block;
Height: 57px;
Width: 277px;
}

 

The size of temp.jpg is 277 × 57.

Normal performance in Firefox:
 

Abnormal performance in IE6:
 



Obviously, we can see that in IE, the Li performance height is not the 57px we set, but higher than it, because there is a 5px blank below IMG.
Solution
1. Let Li float and set IMG as a block-level element


Ul {
Width: 280px;
}
Ul Li {
Float : Left;
Display: block;
Height: 57px;
Width: 277px;
}
IMG {
Display: block;
}


Solution 2: Set UL's font-size to 0;
(I like this)


Ul {
Width: 280px;
Font - Size: 0 ;
}
Ul Li {
Display: block;
Height: 57px;
Width: 277px;
}


Solution 3: Set the img
Vertical-align: Bottom


Ul {
Width: 280px;
Font - Size: 0 ;
}
Ul Li {
Display: block;
Height: 57px;
Width: 277px;
}
IMG {
Vertical - Align: bottom;
}


Solution 4: Set the IMG margin-bottom:
-5px;

Ul {
Width: 280px;
Font - Size: 0 ;
}
Ul Li {
Display: block;
Height: 57px;
Width: 277px;
}
IMG {
Margin - Bottom: - 5px;
}

For details, refer to the unordered list ul bug in the bottom margin of IE6 and IE7.

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.