CSS3 box-orient 属性
指定div元素的子元素横向排列:
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 350px;
height: 100px;
border: 1px solid black;
/* Firefox */
display: -moz-box;
-moz-box-orient: horizontal;
/* Safari, Opera, and Chrome */
display: -webkit-box;
-webkit-box-orient: horizontal;
/* W3C */
display: box;
box-orient: horizontal;
}
</style>
</head>
<body>
<div>
<p>Cat</p>
<p>Dog</p>
<p>Horse</p>
</div>
<p><b>Note:</b> The box-orient property is not supported in IE.</p>
</body>
</html>
浏览器支持
![]()
![]()
![]()
![]()
![]()
目前所有主流浏览器都不支持box-orient属性。
Firefox通过私有属性- MOZ-box-orient支持。
Safari, Opera, 和 Chrome通过私有属性 -webkit-box-orient 支持.
属性定义及使用说明
box-orient 属性指定一个box子元素是否应按水平或垂直排列。
Tip: 水平方向的box里的子元素是由左到右显示,垂直方向的box显示从上到下排列。然而,box-direction方向可由 box-ordinal-group属性改变这个顺序。
| 默认值: | inline-axis |
|---|---|
| 继承: | no |
| 版本: | CSS3 |
| JavaScript 语法: | object.style.boxOrient="vertical" |
语法
box-orient: horizontal|vertical|inline-axis|block-axis|inherit;
| 值 | 说明 |
|---|---|
| horizontal | 指定子元素在一个水平线上从左至右排列 |
| vertical | 从顶部向底部垂直布置子元素 |
| inline-axis | 子元素沿着内联坐标轴(映射到横向) |
| block-axis | 子元素沿着块坐标轴(映射到垂直) |
| inherit | box-orient 属性的值应该从父元素继承 |