您好,欢迎来到飒榕旅游知识分享网。
搜索
您的当前位置:首页css box-orient属性怎么用

css box-orient属性怎么用

来源:飒榕旅游知识分享网
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>

Copyright © 2019- sarr.cn 版权所有 赣ICP备2024042794号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务