中间固定两边自适应 两边固定中间自适应 promise

中间固定两边自适应

www.jianshu.com/p/94666c389…编程

两边固定中间自适应 思路

1.浮动

左浮动, 右浮动固定宽,中间的盒子设置左margin (左浮动盒子的宽度) 右margin(右浮动盒子的宽度)promise

2.定位实现

左定位,右定位,中间同上bash

3.flex布局

父盒子display:flex 左右定宽 中间盒子flex:1异步

#box{
				width:100%;
				height:100px;
				display:flex;
				margin:10px;
			}
			#left,#right{
				width:200px;
				height:100px;
				margin:10px;
				background-color:#999;
			}
			#center{
				flex:1;
				height:100px;
				margin:10px;/*左右margin不会叠加*/
				background-color:#f00;
复制代码

promise

异步编程的一种解决方案,解决了回调地狱的问题,promise是一个构造函数,()里面是一个回调函数,成功操做调用resolve,执行then的回调,失败操做调用reject,执行catch回调异步编程

相关文章
相关标签/搜索