클라우드 융합 Full-stack 웹 개발자 양성과정/HTML, CSS, JavaScript, j-Query

CSS - 화면구조잡기(기본, 실습, 상세구조, 세부구조), 실습

thesunset 2022. 10. 19. 23:59

1. 화면구조잡기-기본

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>화면구조잡기</title>
    <style>
        div{
            border: 1px solid red;
            box-sizing: border-box;
            /* content+padding+margin까지 포함한 %로 나누기 때문에 box-sizing을 border-box로 지정해주기 */
        }
        .wrap{ /*전체를 감싸는 div*/
            width: 1000px;
            height: 800px;
            margin: auto;
        }
        /* 위에서 아래로 지정하는 것이 아닌 부모부터 지정해주어야 함 */
        /* 크게 세 가지 영역 */
        /* #header, #content, #footer */
        .wrap > div{
            width: 100%;
        }
        #header, #footer{ /* 같은 값을 지정할 경우 ,를 이용해서 id를 함께 적어줄 수 있음 */
            height: 20%;
        }
       
        #content{
            height: 60%;
        }
        /* content내부의 세분화된 영역들 */
        #content > div{
            height: 100%;
            float: left;
        }
        #content_1{
            width: 20%;
        }
        #content_2{
            width: 80%;
        }

        /* 부모요소의 세로길이만큼 */
    </style>
</head>
<body>
    <div class="wrap">
        <div id="header"></div>
        <div id="content">
            <div id="content_1"></div>
            <div id="content_2"></div>
        </div>
        <div id="footer"></div>
    </div>
</body>
</html>

2. 화면구조잡기 실습

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>화면구조잡기실습</title>
    <style>
        div{
            border: 1px solid palevioletred ;
            box-sizing: border-box;
        }
        .wrap{
            width: 1000px;
            height: 800px;
        }
        .wrap>div{
            width: 100%;
        }
        #header, #footer{
            height: 20%;
        }
        #content{
            height: 60%;
        }
        /* 세부설정(세로길이) */
        #header>div, #content>div{
            height: 100%;
            float: left;
        }
        /* 세부설정(가로길이) */
        #header1{
            width: 30%;
        }
        #header2{
            width: 70%;
        }
        #content1{
            width: 15%;
        }
        #content2{
            width: 65%;
        }
        #content3{
            width: 20%;
        }

    </style>

</head>
<body>
    <div class="wrap">
        <div id="header">
            <div id="header1"></div>
            <div id="header2"></div>
        </div>
        <div id="content">
            <div id="content1"></div>
            <div id="content2"></div>
            <div id="content3"></div>
        </div>
        <div id="footer"></div>

    </div>

</body>
</html>

3. 화면구조잡기 상세구조

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>화면구조잡기상세구조</title>
    <style>
        div{
            border: 1px solid red;
            box-sizing: border-box;
        }
        /* 전체를 감싸는 div */
        .wrap{
            width: 1000px;
            height: 800px;
            margin: auto;
        }
        /* 큰 4등분 속성 */
        .wrap>div{width:100%;}
        #header, #footer{height: 20%;}
        #navigator{height: 5%;}
        #content{height: 55%;}
        /* 세부 div 속성 */
        #header>div, #content>div{
            height: 100%;
            float: left;
        }
        /* 각각의 요소들 가로 길이 정해주기 */
        #header_1{width: 20%;}
        #header_2{width: 65%;}
        #header_3{width: 15%;}

        #content_1{width: 15%;}
        #content_2{width: 60%;}
        #content_3{width: 25%;}
    </style>
</head>
<body>
    <div class="wrap">
        <div id="header">
            <div id="header_1"></div>
            <div id="header_2"></div>
            <div id="header_3"></div>
        </div>
        <div id="navigator"></div>
        <div id="content">
            <div id="content_1"></div>
            <div id="content_2"></div>
            <div id="content_3"></div>
        </div>
        <div id="footer"></div>
    </div>
</body>
</html>

4. 세부 footer 만들기