练习
This commit is contained in:
69
teaching/林锦绣/float.html
Normal file
69
teaching/林锦绣/float.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.box{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
float:left
|
||||
|
||||
}
|
||||
.box1{
|
||||
width:200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
float:right
|
||||
}
|
||||
.box3{
|
||||
width:200px;
|
||||
height: 200px;
|
||||
background: pink;
|
||||
|
||||
/* clear: both; */
|
||||
}
|
||||
/*
|
||||
display: inline-block 水平排列( 既能设置宽高 又能实现水平排列 从左往右)
|
||||
float 水平排列
|
||||
float 既可以从左往右 又能从右往左
|
||||
|
||||
|
||||
|
||||
浮动元素能够和块级元素 重叠 但是不能跟行框盒子盒子
|
||||
float 造成的父元素高度塌陷的问题
|
||||
|
||||
想给谁清浮动就给谁加clear:both
|
||||
伪元素
|
||||
给加空盒子然后加clear:both;
|
||||
overflow 给父级元素加
|
||||
|
||||
|
||||
*/
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="overflow: auto;">
|
||||
<div class="box"></div>
|
||||
<div class="box1"></div>
|
||||
<!-- <p>
|
||||
float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左
|
||||
</p> -->
|
||||
|
||||
</div>
|
||||
<div class="box3"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user