css实现flex多列布局
今天就跟大家聊聊有关css实现flex多列布局,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
成都创新互联专注于市中企业网站建设,成都响应式网站建设公司,商城网站建设。市中网站建设公司,为市中等地区提供建站服务。全流程按需求定制设计,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务
基本的等分三列布局
.container{
display: flex;
width: 500px;
height: 200px;
}
.left{
flex:1;
background: red;
}
.middle{
flex:1;
background: green;
}
.right{
flex:1;
background: blue;
}

三列 左中定宽 右侧自适应
.container{
display: flex;
height: 300px;
}
.left{
flex: 0 0 100px;
background-color: red;
}
.middle{
flex: 0 0 100px;
background-color: green;
}
.right{
flex:1;
background-color: blue;
}
qqq
qqq
wwww

缩小浏览器窗口后

左右固定,中间自适应
.container{
display: flex;
height: 300px;
}
.left{
width: 100px;
background-color: red;
}
.middle{
flex: 1;
background-color: green;
}
.right{
width: 100px;
background-color: blue;
}
qqq
qqq
wwww

缩小浏览器窗口后

九宫格布局
.container{
display: flex;
height: 300px;
width: 300px;
flex-direction: column;
}
.row{
display: flex;
height: 100px;
}
.left{
flex: 1;
height: 100px;
border: 1px solid red;
}
.middle{
flex: 1;
height: 100px;
border: 1px solid green;
}
.right{
flex: 1;
height: 100px;
border: 1px solid blue;
}

圣杯布局
*{
margin:0;
padding:0;
}
.container{
display: flex;
flex-direction: column;
min-height: 100vh;
justify-content: space-between;
}
.header{
background: red;
flex: 0 0 100px;
}
.content{
display: flex;
flex:1;
}
.content-left{
flex: 0 0 100px;
background: green;
}
.content-right{
flex: 0 0 100px;
background: pink;
}
.content-middle{
flex:1;
}
.footer{
background: yellow;
flex: 0 0 100px;
}
Header
Left
Center
Right
Footer

缩小浏览器窗口之后

看完上述内容,你们对css实现flex多列布局有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
网页标题:css实现flex多列布局
文章URL:http://www.cqwzjz.cn/article/jcgdgs.html


咨询
建站咨询
