码迷,mamicode.com
首页 > 其他好文 > 详细

三列布局

时间:2018-03-03 19:30:57      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:lin   ati   ima   col   splay   grid   display   中间   float   

左右固定宽度,中间自适应。

技术分享图片

//思路float
.float .left{
	float: left;
	width: 200px;
}
.float .right{
	float: right;
	width: 200px;
}

.float .center{
	margin: 0 200px;
}

  

技术分享图片

//思路absolute
.absolute{
	position: relative;
}

.absolute .left{
	position: absolute;
	left: 0;
	width:200px;
}

.absolute .right{
	position: absolute;
	right: 0;
	width: 200px;
}

.absolute .center{
	position: absolute;
	left: 200px;
	right:200px;
}

  

技术分享图片

//思路table
.table{
	display: table;
	width: 100%;
}

.table .left{
	display: table-cell;
	width: 200px;
}

.table .right{
	display: table-cell;
	width: 200px;
}

.table .center{
	display: table-cell;
}

  

技术分享图片

//思路flex
.flex{
	display: flex;
}

.flex .left{
	width: 200px;
}

.flex .right{
	width: 200px;
}

.flex .center{
	flex: 1
}

  

技术分享图片

//思路栅格grid
.grid{
	display: grid;
	width: 100%;
	grid-template-columns: 200px auto 200px;
}

  

技术分享图片

//思路inline-block calc
.inline{
	font-size: 0;
}
		
.inline .left,.inline .right , .inline .center{
	display: inline-block;
	font-size: 18px;
}

.inline .left {
	width: 200px;
}

.inline .right {
	width: 200px;
}

.inline .center {
	width: calc(100vw - 434px);
}

  

三列布局

标签:lin   ati   ima   col   splay   grid   display   中间   float   

原文地址:https://www.cnblogs.com/web-Kongdp/p/8502603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!