欢迎光临散文网 会员登陆 & 注册

html css:div盒子模型色块布局,浮动的用法的理解等

2020-04-27 00:23 作者:诗书画唱  | 我要投稿

个人对浮动的用法的理解:

假如有用div和css样式设置的按顺序的1,2,3个色块,那么在css中,若都设置为”float:left(浮动);“那么会按顺序依次向在水平方向紧贴着地排队



<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>div</title>

<link rel="stylesheet" href="css/div.css">

</head>

<body>

<div id="all">

<div class="one">顶部</div>

<div class="two">

<div class="two_left">左边部分</div> <div class="two_center">中间部分</div> <div class="two_right">右边部分</div>


</div>


<div class="three">底部</div>


</div>

</body>

</html>


#all{

width: 1000px;

height: 600px;

border:1px solid red;

}

.one{

width:1000px;

height:200px;

border:1px solid orange;


}

 

.two{

width: 1000px;

height: 200px;

border:1px solid yellow;



}

.two_left{


width: 247px;

height:200px;

border:1px solid blue;

background-color: greenyellow;

float: left;

}


.two_center{

width: 500px;

height: 200px;

border:1px solid plum;

background-color: yellow;

float: left;

}



.two_right{width: 247px;

height: 200px;

border:1px solid deepskyblue;


float: left;

background-color:greenyellow;

}


.three{

width:1000px;

height: 196px;

border:1px solid green;

margin-right: auto;


}


效果图:





html css:div盒子模型色块布局,浮动的用法的理解等的评论 (共 条)

分享到微博请遵守国家法律