Home >Web Front-end >HTML Tutorial >css 清除浮动的两种常用方式_html/css_WEB-ITnose

css 清除浮动的两种常用方式_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 08:57:241140browse

<!DOCTYPE html><html><head>    <meta charset="UTF-8">    <title></title>    <style type="text/css">        .box1{            background-color: #006486;            float: left;        }        /*清除浮动        .p{            clear: both;        }        */                .p{            width: 100%;            overflow: hidden;        }    </style></head><body>    <div>dfafa</div>    <p>pppppdsfafaf</p>    <div>dsfafa</div></body></html>

float:影响的元素是其紧邻的元素,清除浮动在其紧邻受影响的元素清除即可

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