Home  >  Article  >  Web Front-end  >  Clearing floats (method of clearing floats) created by a foreigner_Experience exchange

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

WBOY
WBOYOriginal
2016-05-16 12:07:311683browse

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.
Statement:
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