ordering in css with 100% width

2019-09-08 05:29发布

I want child div with 100% width.

Is it possible or not ?

html

<div class="main">
    <div class="order2">order2</div>
    <div class="order1">order1</div>
</div>

css

.main{
    display: flex;
}

.order1{
 order:1;
 width:100%;
}
.order2{
 order:2;
width:100%;
}

link > http://jsfiddle.net/gobmo8sL/

标签: css3
3条回答
冷血范
2楼-- · 2019-09-08 05:34

Add flex-direction: column;

.main{
display: flex;
flex-direction: column;
}
查看更多
再贱就再见
3楼-- · 2019-09-08 05:50

you can adjust the directing of the 'flex' display

.main{
    display: flex;
    flex-direction: column;
}

http://jsfiddle.net/gobmo8sL/2/

查看更多
我想做一个坏孩纸
4楼-- · 2019-09-08 05:56

Any reason for using display:flex for the parent div? If you remove that, you are getting a full width child. Also, if you are looking for a listing, go for

<ul> <li> </li></ul>

structure.

查看更多
登录 后发表回答