[CSS] There is a gap bug below the picture inserted by Li in IE6.

Source: Internet
Author: User

There is a gap bug below the picture inserted by Li in IE6, which is a classic bug in IE6. There are many ways to solve this bug. Today I have sorted out four methods in total and I will share them with you.

AttachCode:

 <!  Doctype html  >  <  Html  Lang  = "En-us"  >  <  Head  >      <  Meta  Charset = "UTF-8"  >      <  Title  > </  Title  >      <  Link  REL  = "Stylesheet"  Type  = "Text/CSS"  Href  = "CSS/base.css"  Media  = "All" />      <  Style  Type  = "Text/CSS"  >  Ul  {  Width  :  774px  ;  Overflow  : Hidden  ;  Margin-left  :  Auto  ;  Margin-Right  :  Auto  ;  }  Li {  Float  :  Left  ;  Width  :  248px  ;  Height  :  162px ;  Display  :  Inline  ;  Margin  :  0 10px 10px 0  ;  Background  :  Red ;  }      </  Style  >  </  Head  >  <  Body  >      <  Ul  >          <  Li  > < IMG  SRC  = "Images/cat.jpg"  Width  = "248"  Height  = "162"  ALT  = ""  /> </  Li  >          <  Li  > <  IMG  SRC = "Images/cat.jpg"  Width  = "248"  Height  = "162"  ALT  = ""  /> </  Li  >          <  Li  > <  IMG  SRC  = "Images/cat.jpg"  Width = "248"  Height  = "162"  ALT  = ""  /> </  Li  >          <  Li  > <  IMG  SRC  = "Images/cat.jpg"  Width  = "248"  Height = "162"  ALT  = ""  /> </  Li  >          <  Li  > <  IMG  SRC  = "Images/cat.jpg"  Width  = "248"  Height  = "162"  ALT = ""  /> </  Li  >          <  Li  > <  IMG  SRC  = "Images/cat.jpg"  Width  = "248"  Height  = "162"  ALT  = ""  /> </ Li  >      </  Ul  >  </  Body  >  </  Html  > 

The effect is as follows:

We can see that there is a gap of about 2 PX below the picture in IE6, even if we give the Li width and the picture is equally useful. The following describes several solutions:

Method 1:

Add overflow: hidden to Li;

Method 2:

Add font-size to Ul: 0;

Method 3:

Set the display value of IMG to block.

Method 4:

Set the vertical-align value of IMG to top/middle/bottom.

Related Article

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.