Layout/반응형

layout - 7 (float)

초짜코딩 2022. 4. 17. 18:42

 

    <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;
        }
        #aside {
            width: 20%;
            height: 780px;
            background-color: #91C58A;
            float: left;
        }
        #contents {
            width: 60%;
            height: 780px;
            background-color: #7BB973;
            float: left;
        }
        #aside2 {
            width: 20%;
            height: 780px;
            background-color: #67AD5B;
            float: left;
        }
        #footer {
            width: 100%;
            height: 100px;
            background-color: #5D9E51;
            clear: both;
        }
        @media (max-width: 1300px) {
            #wrap {
                width: 96%;
            }
        }

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

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

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

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

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