CSS 시맨틱 구조로 나눈 예제

최주영·2023년 4월 28일
0

CSS

목록 보기
5/11

(헤더, 섹션[어사이드,아티클],푸터)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>레이아웃</title>
</head>

<body>
<style>
    div.container4>*{
        width: 100%;
        border: 1px solid red;
    }
    div.container4>header{
        height: 100px;
        display: flex;
        justify-content: space-between;
    }
    div.container4>section{
        min-height: 600px;
        display: flex;
    }
    div.container4>section>aside{
        border: 1px solid blue;
        height: 600px;
        width: 20%;
    }
    div.container4>section>div{
        border: 1px solid green;
       min-height: 600px;
        width: 80%;
    }
    div#loginform>form>div:first-child{
        /* first-child -> userId, password 부분에 속함 */
        display: flex;
        flex-direction: column;
        margin-bottom: 2%;    
    }
    div#loginform>form>div:last-child{
        display: flex;
        justify-content: space-evenly;
    }
    div#loginform{
        display: flex;
        align-items: center;
        margin-right: 1.5%;
    }
    aside{
        display: flex;
        /* flex-direction: column;
        justify-content: center; */
        align-items: center;
        justify-content: center;
    }

    aside>ul a:hover{
        color: lightblue;
    }

    aside>ul a{
        text-decoration: none;
        font-size: 25px;
        font-weight: bolder;
        color: cornflowerblue;
    }

    aside>ul{
        padding: 0;
        list-style-type: none;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        height: 600px;
    }

    aside>ul>li{
        margin-bottom: 10%;
    }

    div.content{
        display: flex;
        justify-content: start;
        flex-wrap: wrap;
        /* wrap = 내용들을 한번에 감싸줌 */
    }

    div.content>div{
        margin-left: 5%;
        margin-right: 5%;
    }

    div.content>div>h4{
        text-align: center;
    }
    
    div.content>div>h5:last-child{
        text-align: right;
    }

    div.Product>div{
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    div.Product>div>img{
        cursor: pointer;
    }

</style>
<div class="container4">
<header>
    <div id="logo">
        <img src="./images/나.jpg" alt=""
        width="200" height="100">
    </div>
    <div id="title">
        <h1>레이아웃 설정하기</h1>
    </div>
    <div id="loginform">
        <form action="">
            <div>
                <input type="text" name="userId">
                <input type="text" name="password">
            </div>
            <div>
                <input type="submit" value="로그인">
                <input type="reset" value="취소">
            </div> 
        </form>
    </div>
</header>
<section>
    <aside>
        <ul>
            <li><a href="">Home</a></li>
            <li><a href="">Board</a></li>
            <li><a href="">Product</a></li>
            <li><a href="">Q&A</a></li>
            <li><a href="">Gallary</a></li>
        </ul>
    </aside>
    <div class="content">
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <div>
                <img src="./images/나.jpg" alt="" width="30" height="30"
                onclick="alert('좋아용가리')"><h5>25,000원</h5>
            </div>    
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
        <div class="Product">
            <img src="./images/세숑이.png" width="150" height="150">
            <h4>세숑이 인형</h4>
            <h5>세숑이 인형팝니다</h5>
            <h5>25,000원</h5>
        </div>
    </div>
</section>
</div>

</body>
</html>
profile
우측 상단 햇님모양 클릭하셔서 무조건 야간모드로 봐주세요!!

0개의 댓글