浮动(关键字):float
分左浮动和有浮动,如果要水平居中的话,要给对应的div盒子设置“margin:0 auto”;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>文档流</title>
<style type="text/css">
.box1{
width: 100px;
height: 100px;
background-color: forestgreen;
float: left;
}
.box{
width: 200px;
height: 100px;
margin: 0 auto;
border-style: solid;
border-radius:1px;
border-color:orange;
}
</style>
</head>
<body>
<div class="box">
<div class="box1">
<p style="color: white;font: bold 33px '幼圆';padding-left: 10px;line-height:100%;">网易</p>
</div>
<div class="box1">
<p style="color: burlywood;font: bold 32px '华文彩云';line-height: 110%;">云课堂</p>
</div>
</div>
</body>
</html>
image.png
网友评论