box-orient属性取值如下:
horizontal弹性盒子“从左到右”在一条水平线上显示它的“子元素”
vertical弹性盒子“从上到下”在一条垂直线上显示它的“子元素”
inline-axis弹性盒子“沿着内联轴”显示它的“子元素”(默认值)
block-axis弹性盒子“沿着块轴”显示它的“子元素”
注意:在使用之前,用户必须先把父元素的display属性设置为box或者inline-box,弹性盒子模型才会生效。
举例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
body {
/* 使用box-orient属性定义弹性盒子内部中“子元素”的排列方向。也就是盒子内部的子元素是横着排,还是竖着走。 */
display: -WEBkit-box;
-webkit-box-orient: horizontal;
}
div {
height: 100px;
}
#box1 {
background: red;
}
#box2 {
background: blue;
}
#box3 {
background: yellow;
}
</style>
</head>
<body>
<div id="box1">盒子1</div>
<div id="box2">盒子2</div>
<div id="box3">盒子3</div>
</body>
</html>