Home >Web Front-end >CSS Tutorial >Solution to float causing layer to float out of parent layer_Experience exchange

Solution to float causing layer to float out of parent layer_Experience exchange

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 12:06:031385browse
1. Add clear empty div
.clearfix:after {
content: “.”; display: block;
height: 0;
clear: both;
visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
. clearfix {display: block;}/* End hide from IE-mac */
.clearfix {
display: block;
margin: 0px;
clear: both;
padding: 0px ;
visibility: hidden;
background-color:#666666;
border:0px none #FFFFFF;
}
.clearfix:after { height: 1px;}

Usage:
Add this layer after all floating layers


2. Add floating layers to the background layer, but this method will affect Other divs are sometimes useful.

3. There is also a problem with adding overflow, which will affect the appearance of the div.
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