批改状态:未批改
老师批语:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>6.同级元素之间的清除浮动的技巧</title>
<style type="text/css">
.text {
background-color: yellow;
width: 200px;
height: 200px;
float: right;
clear: both;
}
.box1 {
background-color: blue;
width: 200px;
height: 200px;
float: left;
clear: both;
}.box2 {
background-color: coral;
width: 200px;
height: 200px;
float: right;
clear: both;
}.box3 {
background-color: green;
width: 200px;
height: 200px;
/*float: right;*/
clear: both;
}
</style>
</head>
<body><!--
浮动与绝对定位
相同之处:元素都脱离了文档流,任何元素浮动之后都变成了块元素,都支持宽高,span特点:浮动总是沿着碎屏方向 -->
<span class="text">PHP中文网</span>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号