解析CSS的box model盒模型及其内的子元素布局控制

2020-05-08 09:57:41易采站长站整理

}  

值::
baseline – 基线
center – 居中
end – 底部
inherit – 继承
initial – 默认
start – 顶部
stretch – 拉伸

2.子元素左右对齐方式 box-pack
例子:

CSS Code复制内容到剪贴板

.demo {   
  -webkit-box-pack: center;   
  -moz-box-pack: center;   
  -ms-box-pack: center;   
  box-pack: center;   
}  

值:
center – 居中
end – 底部
inherit – 继承
initial – 默认
start – 顶部
justify – 拉伸

3.子元素排列方式 box-orient
例子:

CSS Code复制内容到剪贴板

.demo {   
  -webkit-box-orient: horizontal;   
  -moz-box-orient: horizontal;   
  -ms-box-orient: horizontal;   
  box-orient: horizontal;   
}  

值:
horizontal – 水平
vertical – 垂直
inherit – 继承
initial – 默认
inline-axis – 内轴
block-axis – 块轴

4.子元素排列顺序 box-ordinal-group
例子:

CSS Code复制内容到剪贴板

.child {   
  -webkit-box-ordinal-group:2;   
  -moz-box-ordinal-group:2;   
  box-ordinal-group:2;   
}  

5.规定框的子元素的显示方向 box-direction
例子:

CSS Code复制内容到剪贴板

.demo {   
  -webkit-box-direction:reverse;   
  -moz-box-direction:reverse;   
  -ms-box-direction:reverse;   
  box-direction:reverse;   
}  

值:
reverse – 反方向
normal – 默认
inherit – 继承