<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
.box{
width:1010px;
height:52px;
border: #c0c0c0 1px solid;
margin: auto;
}
.box1{
/*float:浮动*/
/*float: left(左) right(右); none(没有浮动)*/
/*float:right; 右浮动*/
text-align: center;
float:left;
width:200px;
height:50px;
border: #FFFFFF 1px solid;
background-color:darkred;
font-size: 24px;
color:#FFFFFF;
line-height: 50px;
}
.box2{
width:1010px;
height:200px;
border: #c0c0c0 1px solid;
margin: 10px auto 0;
}
</style>
</head>
<body>
<div class="box">
<div class="box1">我的音乐</div>
<div class="box1">流行音乐</div>
<div class="box1">网络歌曲</div>
<div class="box1">欧美音乐</div>
<div class="box1">华语经典</div>
</div>
<div class="box2"></div>
</body>
</html>
浮动特性
1、浮动元素会脱离标准流(脱标)
2、浮动元素会一行内显示并且元素顶部对齐
3、浮动的元素具有行内块元素的类似特性
HTML第十一次
猜你喜欢
转载自blog.csdn.net/weixin_54989803/article/details/114873550
今日推荐
周排行