练习:
代码:
<!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>浮动元素搭配标准流父盒子1</title>
<style>
/* 整个盒子大小 */
.box{
width: 1200px;
height: 460px;
background:pink;
/* 在页面中间显示 */
margin: 0 auto;
}
/* 左盒子大小 */
.left{
float: left;
width: 230px;
height: 460px;
background-color: purple;
}
/* 右盒子大小 */
.right{
float: left;
width: 970px;
height: 460px;
background-color: skyblue;
}
</style>
</head>
<body>
<div class="box">
<div class="left">左侧</div>
<div class="right">右侧</div>
</div>
</body>
</html>
运行效果: