Several methods for creating fine lines in Div and CSS formatting)

Source: Internet
Author: User

When I made the DIV height control today, I found that it was invalid when the height of the DIV controlled by IE was very small. I checked related articles specially.

Finally, the solution is available. refer to the following article:

If you want to create a line with a height less than 12 PX (approximately), it will be displayed in IE higher than the actual height.

<Style>
. Line {
Background: # cccccc;
Height: 6px;
} </Style>
<Div class = "line"> </div>
It can be seen that the actual height is greater than 6px, which is also a bug in IE. The following three methods can solve this problem. The first method is recommended.
1:

<Style>
. Line11 {
Background: # cccccc;
Height: 6px;
Overflow: hidden;
} </Style>
<Div class = "line11"> </div>
2. Add a space between the Div. Note: ie5.0 is invalid.

<Style>
. Line12 {
Background: #336699;
Line-Height: 6px;
} </Style>
<Div class = "line12"> </div>
3:

<Style>
. Line13 {
Background: # cc0000;
Height: 6px;
Font-size: 1px;
} </Style>
<Div class = "line13"> </div>
Note: There is no problem at all in Firefox. It is an IE bug.
Overflow: hidden;
Font-size: 1px;

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.