CSS tips: About CSS hack with float closure (clear float)

Source: Internet
Author: User
Tags closure wrapper

Core tips: CSS tips: About CSS hack and float closure

First, CSS HACK

The following two methods can solve almost all hack today.


1,!important
With the support of IE7 to!important, the!important method is now targeted only at 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><br/> #wrapper <br/>{<br/> #wrapper {width:120px;} <br/>*html #wrapper {width:80px;} <br/>*+html #wrapper {width:60px;} <br/>}<br/></style><br/>

Attention:
*+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" ">

Two, float closes (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><br/>.clearfix:after<br/>{<br/>content: "."; <br/>display:block;<br/>height:0;<br/>clear:both;<br/>visibility:hidden;<br/>} <br/>.clearfix<br/>{<br/>display:inline-block;<br/>}<br/>.clearfix {Display:block ;} <br/></style><br/>



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.