css固定在右中间位置,css布局,左右固定中间自适应实现
1.絕對定位+浮動
布局測試.demo{
position: relative;
width: 1000px;
height: 400px;
margin: 0 auto;
border: 1px solid red;
}
.left{
float: left;
width: 200px;
height: 100%;
background-color: blue;
}
.mid{
position: absolute;
left: 200px;
right: 100px;
height: 100%;
background-color: yellow;
}
.right{
float: right;
width: 100px;
height: 100%;
background: green;
}
2.table布局實現
布局測試.demo{
position: relative;
display: table;
width: 1000px;
height: 400px;
margin: 0 auto;
border: 1px solid red;
}
.left{
display: table-cell;
width: 200px;
background-color: blue;
}
.mid{
display: table-cell;
background-color: yellow;
}
.right{
display: table-cell;
width: 100px;
background: green;
}
3.flex布局實現
布局測試.demo{
display: flex;
position: relative;
width: 1000px;
height: 400px;
margin: 0 auto;
border: 1px solid red;
}
.left{
width: 200px;
background-color: blue;
}
.mid{
flex: 1;
background-color: yellow;
}
.right{
width: 100px;
background: green;
}
總結
以上是生活随笔為你收集整理的css固定在右中间位置,css布局,左右固定中间自适应实现的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 赋能千行百业 华为终端发布全新商用品牌“
- 下一篇: 服务器数据库端口修改方法,如何修改云服务