About CSS hack with float closure (clear float)

Source: Internet
Author: User
Tags advanced block clear display hack html note writing

CSS HACK
The following two approaches solve almost all hack today.

1,!important

With the support of IE7 to!important, the!important method now only targets IE6 hack. (Note the wording. Remember that the claim position needs to be advanced.)

<style>
#wrapper
{
Width:100px!important;
width:80px;
}
</style></P>
<P>

2, Ie6/ie77 to Firefox

*+html and *html is the unique label of IE, Firefox is not supported. And *+html is IE7 unique label.

<style>
#wrapper
{
#wrapper {width:120px;}
*html #wrapper {width:80px}
*+html #wrapper {width:60px}
}
</style>

Note:
*+html to IE7 hack must ensure that the top of the HTML has the following declaration:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" ">
Float closure (Clear float)
Add the following code to the global CSS, to the need to close the div plus class= "clearfix" can be, once and for all.
<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.