css box-ordinal-group属性怎么用


本文摘自PHP中文网,作者silencement,侵删。

css box-ordinal-group属性是css3中新增属性,是使用来规定box子元素显示的次序,目前主流浏览器都还不支持该属性。但是一些主流浏览器有对应的私有属性来代替该属性,Internet Explorer 10支持ms-flex-order属性,Internet Explorer 10之前版本不支持弹性盒属性。Firefox内核的浏览器支持-moz-box-ordinal-group属性。Safari和Chrome内核的浏览器支持-webkit-box-ordinal-group属性。

css box-ordinal-group属性语法格式

1

box-ordinal-group: integer;

css box-ordinal-group属性值说明

integer:整数,指示子元素的显示次序。值小的元素会显示在值高的元素前面,值相同的元素,显示顺序取决于其源次序

实例

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

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>css3 box-ordinal-group属性设置box子元素的显示顺序</title>

<style type="text/css">

body{background-color: #aaa;}

div{width: 400px;height: 200px;border:1px solid mediumvioletred;}

.box1{

display:box;/* W3C */

display:-ms-flexbox;/* Internet Explorer 10 */

display:-moz-box;/* Firefox */

display:-webkit-box;/* Safari, Opera, and Chrome */

}

#p1,#p2,#p3,#p4{width:50px;border:1px solid royalblue;margin-left:6px;}

#p1{

box-ordinal-group:2;

-ms-flex-order:2; /* Internet Explorer 10 */

-moz-box-ordinal-group:2; /* Firefox */

-webkit-box-ordinal-group:2; /* Safari and Chrome */

}

#p4{

box-ordinal-group:1;

-ms-flex-order:1; /* Internet Explorer 10 */

-moz-box-ordinal-group:1; /* Firefox */

-webkit-box-ordinal-group:1; /* Safari and Chrome */

}

</style>

</head>

<body>

<div class="box1"><p id="p1">1</p><p id="p2">2</p><p id="p3">3</p><p id="p4">4</p></div>

</body>

</html>

运行结果

182ff7ebc200fc69ecb7ed295dcac3d.png


以上就是css box-ordinal-group属性怎么用的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

css动画用什么规则

关于css文本属性的详细介绍

css为什么加了top移动不了

css怎么实现平方

css定位有哪些

css怎么选择奇偶行元素

浅谈css如何实现九宫格提示超出数量

html+css如何实现自定义图片上传按钮

css怎么控制按钮不可用

css怎么设置链接样式

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...