Home  >  Article  >  Web Front-end  >  How to set up the middle adaptation of the flexible box (code tutorial)

How to set up the middle adaptation of the flexible box (code tutorial)

云罗郡主
云罗郡主forward
2018-10-19 15:11:593949browse

The content of this article is about how to set up the middle adaptation of the flexible box (code tutorial). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

How to set up the middle adaptation of the flexible box (code tutorial)

nbsp;html>


	<meta>
	<title>弹性盒子中间自适应</title>
	<style>
	/*
		父级添加
			display:-webkit-box;
			display:-moz-box;
		子级添加
			box-flex:1;
			-webkit-box-flex:1;
			-moz-box-flex:1;
			定义子容器占的比例, 具体计算规则,父容器-定宽,剩余的按比例等分。
			但实际计算中并没有实现等分(子容器中还有元素时),常用的解决方法是,
			数字 1 为所占的份数
			添加宽度百分比和box-sizing: border-box;(解决border和padding问题)

	*/
	#wrap{
		width:100%;
		margin:0 auto;
		background: #ccc;
		display:-webkit-box;
		display:-moz-box;
	}
	#left{
		width:100px;
		padding:10px;
		background:#09F;
	}
	#content{
		/*width:400px;*/
		padding:10px;
		background:#30C;
		box-flex:1;
		-webkit-box-flex:1;
		-moz-box-flex:1;
	}
	#right{
		/*width:100px;*/
		padding:10px;
		background:#F0F;
		box-flex:1;
		-webkit-box-flex:1;
		-moz-box-flex:1;
	}

	#left,#content,#right{
		box-sizing:border-box;
		-webkit-box-sizing:border-box;
		-moz-box-sizing:border-box;
	}
	</style>



	<p>
		</p><p>#f00</p>
		<p>#0f0</p>
		<p>#00F</p>
	

The above is the complete introduction to how to set up the middle adaptation of the elastic box (code tutorial), if you want to know more about CSS video tutorial , please pay attention to the PHP Chinese website.


The above is the detailed content of How to set up the middle adaptation of the flexible box (code tutorial). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete