초짜코딩의 잡동사니

layout - 8 (float) 본문

Layout/반응형

layout - 8 (float)

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

        body {
            background-color: #E1F5FE;
        }

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

        #header {
            height: 100px;
            background-color: #BBDEFB;
        }

        #nav {
            height: 100px;
            background-color: #90CAF9;
        }

        #aside {
            width: 30%;
            height: 780px;
            background-color: #64B5F6;
            float: left;
        }

        #article1 {
            width: 70%;
            height: 260px;
            background-color: #42A5F5;
            float: left;
        }

        #article2 {
            width: 70%;
            height: 260px;
            background-color: #2196F3;
            float: left;
        }

        #article3 {
            width: 70%;
            height: 260px;
            background-color: #1E88E5;
            float: left;
        }

        #footer {
            height: 100px;
            background-color: #0A78DD;
            clear: both;
        }

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

            #article1 {
                width: 70%;
                height: 390px;
                background-color: #42A5F5;
                float: left;
            }

            #article2 {
                width: 70%;
                height: 390px;
                background-color: #2196F3;
                float: left;
            }

            #article3 {
                width: 35%;
                height: 520px;
                background-color: #1E88E5;
                float: left;
            }
        }

        @media (max-width: 768px) {
            #aside{
                display: none;
            }
            #article1 {
                width: 100%;
                height: 200px;
                background-color: #42A5F5;
                float: left;
            }

            #article2 {
                width: 100%;
                height: 430px;
                background-color: #2196F3;
                float: left;
            }

            #article3 {
                width: 100%;
                height: 150px;
                display: block;
            }


        }
    </style>​
    <div id="wrap">
        <header id="header"></header>
        <nav id="nav"></nav>
        <aside id="aside"></aside>
        <article id="article1"></article>
        <article id="article2"></article>
        <article id="article3"></article>
        <footer id="footer"></footer>
    </div>

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

layout - 9  (0) 2022.04.17
layout - 8 (flex)  (0) 2022.04.17
layout - 8 (grid)  (0) 2022.04.17
layout - 7 (grid)  (0) 2022.04.17
layout - 7 (float)  (0) 2022.04.17