サマリー:CSS浮動float的運(yùn)用 float:left ,應(yīng)用之后標(biāo)簽會脫離文檔流,注意清除浮動<!DOCTYPE html><html><head><meta charset="UTF-8"><title>css 的浮動</title><style type="text/cs
CSS浮動float的運(yùn)用 float:left ,應(yīng)用之后標(biāo)簽會脫離文檔流,注意清除浮動
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>css 的浮動</title>
<style type="text/css">
ul li{
list-style: none;
width:100px;
height:40px;
line-height: 40px;
text-align:center;
background:#ccc;
margin:5px 0;
float:left;
}
.box1{
width:200px;
height:200px;
border:1px solid red;
background-color: blue;
float:right;
}
.clear{
clear:both;
}
</style>
</head>
<body>
<ul>
<li>html</li>
<li>css</li>
<li>javascript</li>
<li>jquery</li>
<li>php</li>
</ul>
<div></div>
<div>div1</div>
<div>div2</div>
</body>
</html>
添削の先生:天蓬老師添削時(shí)間:2019-03-28 09:52:01
先生のまとめ:清除浮動并不是必須的, 除非后面的元素有影響