css
.layout-absolute .absolute-content {
position: relative;
}
.layout-absolute .absolute-content div {
min-height: 100px;
}
.layout-absolute .absolute-content .left {
position: absolute;
left: 0;
width: 300px;
background: pink;
}
.layout-absolute .absolute-content .right {
position: absolute;
right: 0;
width: 300px;
background: yellow;
}
.layout-absolute .absolute-content .center {
position:absolute;
left: 300px;
right: 300px;
background: red;
}
html
css
.flexbox-content {
display: flex;
width: 100%;
}
.flexbox-content div {
min-height: 100px;
}
.flexbox-content .left {
width: 300px;
background: pink;
}
.flexbox-content .right {
width: 300px;
background: yellow;
}
.flexbox-content .center {
flex: 1;
background: red;
}
html
css
.table-content {
display: table;
width: 100%;
}
.table-content div{
display: table-cell;
height: 100px;
}
.table-content .left {
width: 300px;
background: pink;
}
.table-content .center {
background: red;
}
.table-content .right {
width: 300px;
background: yellow;
}
html
css
.grid-content {
display: grid;
width: 100%;
grid-template-rows: 100px;
grid-template-columns: 300px auto 300px;
}
.grid-content .left {
background: pink;
}
.grid-content .center {
background: red;
}
.grid-content .right {
background: yellow;
}
html
- 假如把高度已知去掉或者高度超出
- 1.flex布局高度可以自适应
- 2.表格布局高度可以自适应
- 3.浮动,绝对定位,网格布局不能自适应高度
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!