๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐ŸŒŒ | WEB DEV/HTML CSS

HTML ์‹œ๋ฉ˜ํ‹ฑ ํƒœ๊ทธ (๋ ˆ์ด์•„์›ƒ ์„ค๊ณ„)

by KASSID 2022. 1. 5.

๋ชฉ์ฐจ

    728x90

    semantic : ์˜๋ฏธ๋ก ์ ์ธ, ์˜๋ฏธ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”

     

    HTML5 ์ด์ „์— ๋ ˆ์ด์•„์›ƒ์„ ๊ตฌ์„ฑํ•  ๋•Œ div์— ํด๋ž˜์Šค๋ฅผ ๋ถ€์—ฌํ•˜๋ฉฐ ๊ตฌ์„ฑํ•˜์˜€๋‹ค.

    ์ด๋Š” htmlํŒŒ์ผ์ด ๊ธธ์–ด์ง€๊ณ  div๋ฅผ ๊ณ„์† ๋ฐ˜๋ณตํ•ด์„œ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค.

     

    ๊ทธ ์ดํ›„

    sementicํƒœ๊ทธ์˜ ๋“ฑ์žฅ์œผ๋กœ ํšจ์œจ์ ์ด๊ณ  ์ง๊ด€์ ์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๊ฒŒ๋˜์—ˆ๋‹ค!

     

    ์ข…๋ฅ˜

    .container : ๊ฐ€์žฅ ์ƒ์œ„

    section : ์ฃผ์ œ๋ณ„ ์ปจํ…์ธ  ์˜์—ญ

    header : ํ—ค๋” ์˜์—ญ(๋กœ๊ณ , ๋ฉ”๋‰ด ๋“ฑ)

    footer : ํ‘ธํ„ฐ(์ œ์ž‘ ์ •๋ณด ๋“ฑ)

    aricle : ์ปจํ…์ธ  ๋‚ด์šฉ

    nav : ๋ฌธ์„œ ๋งํฌ ํƒ์ƒ‰

    main : ๋ฌธ์„œ ์ฃผ์š” ๋‚ด์šฉ ์ง€์ •

     

    ๋‹จ๊ณ„

    .container>section, header, footer>article>div


    ๋ ˆ์ด์•„์›ƒ ๋งŒ๋“ค์–ด๋ณด๊ธฐ(๊ฐ€์ƒํด๋ž˜์Šค X)

    <div class="container">
        <header>
            <article class="logo"></article>
            <article class="navi"></article>
        </header>
        <section class="box1"></section>
        <section class="box2">
            <article class="sub1"></article>
            <article class="sub2"></article>
            <article class="sub3"></article>
        </section>
        <footer></footer>
    </div>

     

    .container {
        border: 1px solid #000;
        width: 1200px;
        margin: auto;
    }
    header {
        background-color: blueviolet;
        height: 100px; /*header์—๋Š” overflow๋ฅผ ์ฃผ์ง€ ์•Š๋Š”๋‹ค*/
    }
    header article {  /*๊ณตํ†ต์ ์ธ ๊ฒƒ ๋„ฃ์–ด์ฃผ๊ธฐ*/
        background-color: silver;
        width: 300px;
        height: 100px;
    }
    .logo { /*๊ฐœ๋ณ„์ ์ธ ๊ฒƒ๋“ค*/
        float: left; /*๋‘˜ ๋‹ค float์„ ๋ถ€์—ฌํ•ด์•ผ ๊ฐ™์€ ๋†’์ด์— ์œ„์น˜*/
    }
    .navi {
        float: right;
    }
    
    .box1 {
        background-color:mediumpurple;
        height: 500px;
    }
    .box2 {
        background-color: mediumslateblue;
        overflow: hidden;
    }
    .box2 article {
        width: 33.3333%; /*์†Œ์ˆ˜์ ์„ ๋Š˜๋ ค์•ผ ์˜ค์ฐจ๋ฐœ์ƒ X*/
        height: 500px;
        box-sizing: border-box;
        float: left;
    }
    .sub1 {
        background-color:slateblue;
    }
    .sub2 {
        background-color:rebeccapurple;
    }
    .sub3 {
        background-color:rgb(145, 131, 231);
    }
    
    footer {
        background-color: blueviolet;
        height: 100px;
    }

    ๊ฐ€์ƒํด๋ž˜์Šค๋ฅผ ์•„์ง ๋ฐฐ์šฐ์ง€ ์•Š์•˜์ง€๋งŒ ๊ตฌํ˜„์„ ํ•ด๋ณด์•˜๋‹ค.

     

    ๋Œ“๊ธ€