Css hack and float floating implementation code

Source: Internet
Author: User
Tags wrapper

I. css hack

The following two methods can solve almost all today's hack.
1 ,! Important
With ie7! Important support ,! The important method is only for the hack of ie6. (note the writing method. Remember to advance the declaration position .)

 

The code is as follows: Copy code
<Style>
# Wrapper
{
Width: 100px! Important;
Width: 80px;
}
</Style>

2, ie6/ie77 for firefox
* + Html and * html are unique tags of ie, which are not supported by firefox at the moment. * + html is also a unique tag of ie7.

 

The code is as follows: Copy code
<Style>
# Wrapper
{
# Wrapper {width: 120px ;}
* Html # wrapper {width: 80px ;}
* + Html # wrapper {width: 60px ;}
}
</Style>

Note:
* + The html hack for ie7 must ensure that the following statements are made on the top of the html:
<! Doctype html public "-// w3c // dtd html 4.01 transitional // en">

2. float closure (clear floating)

Add the following code to global css and add class = "clearfix" to the div to be closed.

The code is as follows: Copy code
<Style>
. Clearfix: after
{
Content :".";
Display: block;
Height: 0;
Clear: both;
Visibility: hidden;
}
. Clearfix
{
Display: inline-block;
}
. Clearfix {display: block ;}
</Style>

 

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.