©
本文档使用
php中文网手册 发布
order:<integer>
默认值:0
适用于:flex子项和flex容器中的绝对定位子元素
继承性:无
动画性:是
计算值:指定值
<integer>:用整数值来定义排列顺序,数值小的排在前面。可以为负值。
order定义将会影响 <' position '> 值为static元素的层叠级别,数值小的会被数值大的盖住。
demo:
.test { display: flex; } .item2 { order: -1; margin: -30px; } <div class="test"> <p class="item1">flex item1</p> <p class="item2">flex item2</p> </div>
此时,item1将会盖在item2之上
对应的脚本特性为order。
| Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
|---|---|---|---|---|---|---|---|---|
| Basic Support | 6.0-10.0 | 2.0-21.0 | 4.0-20.0 | 6.0 | 15.0+-webkit- | 6.0-6.1 | 2.1-4.3 | 18.0-19.0 |
| 11.0+ | 22.0+ | 21.0+-webkit- | 6.1+-webkit- | 17.0+ | 7.0+-webkit- | 4.4+ | 20.0+-webkit- | |
| 29.0+ | 9.0+ | 9.0+ | 28.0+ |
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>order_CSS参考手册_web前端开发参考手册系列</title>
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<style>
h1{font:bold 20px/1.5 georgia,simsun,sans-serif;}
.box{
display:-webkit-flex;
display:flex;
margin:0;padding:10px;list-style:none;background-color:#eee;}
.box li{width:100px;height:100px;border:1px solid #aaa;text-align:center;}
#box li:nth-child(3){
-webkit-order:-1;
order:-1;
}
</style>
</head>
<body>
<h1>order示例:</h1>
<ul id="box" class="box">
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
</ul>
</body>
</html>
点击 "运行实例" 按钮查看在线实例