<!-- 浮动 -->
<!-- 块元素在文档流中默认垂直排列
如果希望块元素在页面中水平排列
可以是其脱离文档流
使用float来使元素浮动,从而脱离文档流
可选值:
none:默认值,认在文档流中排列
left:像左浮动
right:向右浮动
元素浮动以后,会尽量向页面的左上和右上浮动,
知道遇到父元素的边框
**如果浮动元素上边是个没有浮动的
块元素,则浮动元素不会超过他
-->
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
.box1{
border: 200px,200px,red;
float:right;
}
.box2{
border: 200px,200px,red;
float:none;
}
.box2{
border: 200px,200px,red;
float:left;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=
, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</body>
</html>
什么是css的浮动
最新推荐文章于 2022-08-28 20:49:35 发布