Clearing floats (method of clearing floats) created by a foreigner_Experience exchange

WBOY
Release: 2016-05-16 12:07:31
Original
1660 people have browsed it

What I commonly use is the clear:both; method, such as









I saw another method like this in PlanABC, so I recorded it.

div.container {
border: 1px solid #000000;
}

div.left {
width: 45%;
float: left; }

div.right {
width: 45%;
float: right;
}


Layer nesting relationship: container's div contains left and right

The simplest and most reasonable way to clear floats (red bold part):

div.container {
border: 1px solid #000000;
overflow: hidden;
width: 100%;
}

Compatibility: IE6 IE7 FF MacIE, etc.

Source address: http://www.quirksmode.org/css/clearing.html

PS: However, there seems to be a small bug in the process of using it. Xiaoma from Taobao has encountered it. The specific symptom is that the IE6 middle layer clears the floating divs, causing some links to be unclickable.
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!