The order property specifies the order of a flexible item relative to the rest of the flexible items inside the same container:
HTML file: | Displayed by browser: |
---|---|
<style>
.flex-container { display: -webkit-flex; display: flex; width: 400px; height: 250px; background-color: lightgrey; } .flex-item { background-color: cornflowerblue; width: 100px; height: 100px; margin: 10px; } .first { -webkit-order: -1; order: -1; } </style> <body> <div class="flex-container"> <div class="flex-item">flex item 1</div> <div class="flex-item first">flex item 2</div> <div class="flex-item">flex item 3</div> </div> </body> |
flex item 1
flex item 2
flex item 3
|
Note: If the element is not a flexible item, the order property has no effect.