清除浮动后为什么元素是靠右垂直排列而不是之前的靠左垂直排列?
3个元素 div1,div2,div3
设置3个元素向右浮动
清除浮动
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
div{border: 2px solid black}
.div1{width: 100px;height: 100px;background-color: red;float: right;}
.div2{width: 100px;height: 100px;background-color: blue;float: right;}
.div3{width: 100px;height: 100px;background-color: orange;float: right;}
</style>
</head>
<body>
<div class="clear">
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</div>
</body>
</html>
墨者舞驰
相关分类