• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>CSS3 Flexible Box Layout</title>
7
    <style>
8
        .flexbox {
9
            background-color: dimgray;
10
            width: 300px;
11
            height: 300px;
12
            border-radius: 15px;
13
            display: -webkit-flex;
14
            display: flex;
15
            -webkit-flex-wrap: wrap;
16
            flex-wrap: wrap;
17
        }
18
        .item {
19
            background-color: darkgray;
20
            border-radius: 10px;
21
            width: 80px;
22
            height: 50px;
23
            margin: 10px;
24
            color: white;
25
            font-size: 26px;
26
            text-align: center;
27
            line-height: 50px;
28
        }
29
        #first {
30
            -webkit-order: -1;
31
            order: -1;
32
        }
33
    </style>
34
</head>
35
​
36
<body>
37
​
38
    <h1>order 속성을 이용한 플렉스 요소의 순서 설정</h1>
39
​
40
    <div class="flexbox">
41
        <div class="item">1</div>
42
        <div class="item">2</div>
43
        <div class="item">3</div>
44
        <div class="item" id="first">4</div>
45
        <div class="item">5</div>
46
        <div class="item">6</div>
47
    </div>
48
​
49
</body>
50
​
51
</html>