本文摘自PHP中文网,作者藏色散人,侵删。
css order属性用于设置或检索弹性盒模型对象的子元素出现的?序,CSS语法是order: number|initial|inherit。css order属性怎么用?
定义和用法
order 属性 设置或检索弹性盒模型对象的子元素出现的?序。。
注意:如果元素不是弹性盒对象的元素,则 order 属性不起作用。
默认值: 0
继承: 否
可动画化: 是,参见个别的属性。请参阅 可动画化(animatable)。
版本: CSS3
JavaScript 语法:
CSS 语法
1 | order: number|initial|inherit;
|
属性值
number 默认值是 0。规定灵活项目的顺序。
initial 设置该属性为它的默认值。请参阅 initial。
inherit 从父元素继承该属性。请参阅 inherit。
实例
设置弹性盒对象元素的顺序:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <!DOCTYPE html>
<html>
<head>
<meta charset= "utf-8" >
<title></title>
<style>
#main {
width: 400px;
height: 150px;
border: 1px solid #c3c3c3;
display: -webkit-flex;
display: flex;
}
#main div {
width: 70px;
height: 70px;
}
div#myRedDIV {-webkit-order: 2;}
div#myBlueDIV {-webkit-order: 4;}
div#myGreenDIV {-webkit-order: 3;}
div#myPinkDIV {-webkit-order: 1;}
div#myRedDIV {order: 2;}
div#myBlueDIV {order: 4;}
div#myGreenDIV {order: 3;}
div#myPinkDIV {order: 1;}
</style>
</head>
<body>
<div id= "main" >
<div style= "background-color:coral;" id= "myRedDIV" ></div>
<div style= "background-color:lightblue;" id= "myBlueDIV" ></div>
<div style= "background-color:lightgreen;" id= "myGreenDIV" ></div>
<div style= "background-color:pink;" id= "myPinkDIV" ></div>
</div>
<p><b>注意:</b> Internet Explorer 10 及更早版本浏览器不支持 order 属性。</p>
<p><b>注意:</b> Safari 6.1 及更新版本通过 -webkit-order 属性支持该属性。</p>
</body>
</html>
|
效果输出:
以上就是css order属性怎么用的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
css a为什么设不了宽度
css的字体样式如何设置
css如何设置输入框不可编辑
css的flex怎么根据内容更改高度
css position 属性值有哪些?
css伪类是什么
css表示什么
css怎么设置边框为虚线样式
15 个优秀的响应式 web 设计 html 和 css 框架
css如何禁止选中页面内容
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css order属性怎么用