当前位置:Gxlcms > css > cssbox-orient属性怎么用

cssbox-orient属性怎么用

时间:2021-07-01 10:21:17 帮助过:56人阅读

css box-orient属性用于指定box(框)的子元素是否应按水平或垂直排列。水平框中的子元素从左向右进行显示,而垂直框的子元素从上向下进行显示。

css box-orient属性怎么用?

box-orient属性规定框的子元素是否应水平或垂直排列。

语法:

box-orient: horizontal|vertical|inline-axis|block-axis|inherit;

属性值:

horizontal:在水平行中从左向右排列子元素。

vertical:从上向下垂直排列子元素。

inline-axis:沿着行内轴来排列子元素(映射为 horizontal)。

block-axis:沿着块轴来排列子元素(映射为 vertical)。

inherit:应该从父元素继承 box-orient 属性的值。

说明:水平框中的子元素从左向右进行显示,而垂直框的子元素从上向下进行显示。不过,box-direction 和 box-ordinal-group 能够改变这种顺序。

注:目前所有主流浏览器都不支持box-orient属性。Firefox通过私有属性- MOZ-box-orient支持。Safari, Opera, 和 Chrome通过私有属性 -webkit-box-orient 支持。

css box-orient属性 示例

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<style>
			div {
				width: 350px;
				height: 150px;
				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>段落 1。</p>
			<p>段落 2。</p>
			<p>段落 3。</p>
		</div>

		<p><b>注释:</b>IE 不支持 box-orient 属性。</p>

	</body>

</html>

以上就是css box-orient属性怎么用的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行