초짜코딩의 잡동사니

layout -7 (flex) 본문

Layout/반응형

layout -7 (flex)

초짜코딩 2022. 4. 17. 18:32
    <style>
        * {
            margin: 0;
        }

        body {
            background-color: #FFF3E0;
        }

        #wrap {
            width: 1200px;
            margin: 0 auto;
        }

        #header {
            width: 100%;
            height: 100px;
            background-color: #CEE5CB;
        }

        #nav {
            width: 100%;
            height: 100px;
            background-color: #AFD5AB;
        }

        #main {
            display: flex;
        }

        #side {
            width: 20%;
            height: 600px;
            background-color: #91C58A;
        }

        #contents {
            width: 60%;
            height: 600px;
            background-color: #7BB973;
        }

        #side2 {
            width: 20%;
            height: 600px;
            background-color: #67AD5B;

        }

        #footer {
            width: 100%;
            height: 100px;
            background-color: #5D9E51;
        }

        @media (max-width: 1300px) {
            #wrap {
                width: 96%;
            }
        }

        @media (max-width: 768px) {
            #wrap {
                width: 100%;
            }
            #main {
                flex-wrap: wrap;
            }

            #side {
                width: 30%;
                height: 630px;
                background-color: #91C58A;
            }

            #contents {
                width: 70%;
                height: 630px;
                background-color: #7BB973;
            }

            #side2 {
                width: 100%;
                height: 150px;
                background-color: #67AD5B;
            }
        }

        @media (max-width: 480px){
           #side {
               width: 100%;
               height: 200px;
           }
           #contents {
               width: 100%;
               height: 430px;
           }
           #side2 {
               width: 100%;
               height: 150px;
           }
        }
    </style>​
    <div id="wrap">
        <header id="header"></header>
        <nav id="nav"></nav>
        <main id="main">
            <aside id="side"></aside>
            <section id="contents"></section>
            <aside id="side2"></aside>
        </main>
        <footer id="footer"></footer>
    </div>

'Layout > 반응형' 카테고리의 다른 글

layout - 7 (grid)  (0) 2022.04.17
layout - 7 (float)  (0) 2022.04.17
layout - 6 (grid)  (0) 2022.04.17
layout - 6 (flaot)  (0) 2022.04.17
layout - 6 (flex)  (0) 2022.04.17