<!DOCTYPE html>
<html>
<head>
<title>BFC</title>
<style>
body {
overflow: scroll;
}
/* position:absolute */
.left, .right {
position: absolute;
width: 230px;
top: 0;
height: 50px;
background-color: blue;
}
.left {
left: 0;
}
.right {
right: 0;
}
.main {
margin: 0 230px;
height: 50px;
background-color: blueviolet;
}
/* float */
#content2 {
margin-top: 30px;
width: 100%;
}
#left1 {
float: left;
width: 230px;
background-color: blue;
height: 50px;
}
#right1 {
float: right;
width: 230px;
background-color: blue;
height: 50px;
}
#main1 {
background-color: blueviolet;
height: 50px;
}
/* display:table */
#content3 {
display: table;
margin-top: 40px;
width: 100%;
height: 50px;
}
#left2 {
display: table-cell;
width: 230px;
css 五种两边固定,中间自适应的实现方式
最新推荐文章于 2022-05-25 13:00:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)