๐ŸŽ ๋“ค์–ด๊ฐ€๊ธฐ์— ์•ž์„œ

์ด ๊ธ€์€ ๋ชจ๋˜ ์›น์„ ์œ„ํ•œ HTML5+CSS3 ๋ฐ”์ด๋ธ”์„ ๊ณต๋ถ€ํ•˜๋ฉฐ ๊ธฐ์–ตํ•ด๋‘˜ ๋‚ด์šฉ๋“ค์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ธฐ๋กํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค.
์ฑ…์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์‚ฌํ•ญ์€ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”. ๐Ÿ‘

๐Ÿ“– 1. ์†Œ์…œ์ปค๋จธ์Šค ๋ฉ”์ธ ํŽ˜์ด์ง€

์ฝ”๋“œ๋ฅผ ์ญ‰ ๋‚˜์—ดํ•˜๊ณ  ์ฃผ์„์œผ๋กœ ๋„์›€๋˜๋Š” ํŒ๋“ค(๐ŸŒŸ๋กœ ํ‘œ์‹œํ•ด๋‘๊ฒ ์Šต๋‹ˆ๋‹ค.)์„ ๊ธฐ๋กํ•˜๋ ค ํ•ฉ๋‹ˆ๋‹ค. ์ฝ”๋“œ ์›๋ณธ์€ ๋งํฌ์—์„œ ๋ฐ›์œผ์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

<!DOCTYPE html>
<html>
  <head>
    <title>Chapter 8</title>
    <!-- ๊ตฌ ๋ฒ„์ „์˜ ์ธํ„ฐ๋„ท ์ต์Šคํ”Œ๋กœ๋Ÿฌ์—์„œ HTML5 ํƒœ๊ทธ๋ฅผ ์ธ์‹ํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. -->
    <!--[if lt IE 9]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- ์ดˆ๊ธฐํ™” -->
    <style>
      * {
        margin: 0;
        padding: 0;
        font: normal 12px 'Dotum';
      }
      a {
        text-decoration: none;
      }
      img {
        border: 0;
      }
      ul {
        list-style: none;
      }
      /* ๐ŸŒŸ ์ค‘์•™์— ์œ„์น˜ํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. */
      body {
        width: 980px;
        margin: 0 auto;
      }
    </style>
    <!-- ํ—ค๋” -->
    <style>
      /* ๐ŸŒŸ ์ž์† ํƒœ๊ทธ์— position: absolute; ๋ผ๋ฉด ๋ถ€๋ชจ ํƒœ๊ทธ์— position: relative; ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ’ฏ */
      #main_header {
        position: relative;
        height: 75px;
      }

      #main_header > h1.logo {
        position: absolute;
        left: 15px;
        top: 10px;
      }

      #main_header > div.login_menu {
        position: absolute;
        top: 10px;
        right: 0px;
      }
    </style>
    <!-- ์‚ฌ์ด๋“œ -->
    <style>
      /* ๐ŸŒŸ ์ž์† ํƒœ๊ทธ์— position: absolute; ๋ผ๋ฉด ๋ถ€๋ชจ ํƒœ๊ทธ์— position: relative; ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ’ฏ */
      body {
        position: relative;
      }

      #global_aside {
        position: absolute;
        left: 990px;
        top: 75px;
        width: 90px;
      }

      #global_aside > a {
        display: block;
        margin-bottom: 5px;
      }
    </style>
    <!-- ๋„ค๋น„๊ฒŒ์ด์…˜_์œ„ -->
    <style>
      /* ๐ŸŒŸ ์ž์† ํƒœ๊ทธ์— float ์†์„ฑ์„ ์ ์šฉํ•˜๋ฉด ๋ถ€๋ชจ ํƒœ๊ทธ์— overflow: hidden; ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ’ฏ */
      #top_gnb {
        overflow: hidden;
      }

      #top_gnb > div.menu {
        float: left;
        width: 140px;
        height: 50px;
        background: url('Images/top_gnb.png');
      }
      /* ๐ŸŒŸ ์Šคํ”„๋ผ์ดํŠธ ์ด๋ฏธ์ง€์—์„œ ๊ฐ๊ฐ์˜ ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด background-position์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
      2๊ฐœ์˜ ์ธ์ž์ผ ๋•, ์ฒซ ๋ฒˆ์งธ ๊ฐ’์ด x ์ถ•, ๋‘ ๋ฒˆ์งธ ๊ฐ’์ด y ์ถ•์ž…๋‹ˆ๋‹ค.
      ๋งˆ์น˜ ํฌํ† ์ƒต ๋ ˆ์ด์–ด์—์„œ ๋ฐฐ๊ฒฝ ๋ ˆ์ด์–ด๋ฅผ ์›€์ง์ธ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๋ฉด ํŽธํ•ฉ๋‹ˆ๋‹ค. */
      #top_gnb > div.item_1 {
        background-position: 0px 0px;
      }
      #top_gnb > div.item_2 {
        background-position: 0px -50px;
      }
      #top_gnb > div.item_3 {
        background-position: 0px -100px;
      }
      #top_gnb > div.item_4 {
        background-position: 0px -150px;
      }
      #top_gnb > div.item_5 {
        background-position: 0px -200px;
      }
      #top_gnb > div.item_6 {
        background-position: 0px -250px;
      }
      #top_gnb > div.item_7 {
        background-position: 0px -300px;
      }

      #top_gnb > div.item_1:hover {
        background-position: 0px -350px;
      }
      #top_gnb > div.item_2:hover {
        background-position: 0px -400px;
      }
      #top_gnb > div.item_3:hover {
        background-position: 0px -450px;
      }
      #top_gnb > div.item_4:hover {
        background-position: 0px -500px;
      }
      #top_gnb > div.item_5:hover {
        background-position: 0px -550px;
      }
      #top_gnb > div.item_6:hover {
        background-position: 0px -600px;
      }
      #top_gnb > div.item_7:hover {
        background-position: 0px -650px;
      }

      #top_gnb > div.item_1.active {
        background-position: 0px -350px;
      }
      #top_gnb > div.item_2.active {
        background-position: 0px -400px;
      }
      #top_gnb > div.item_3.active {
        background-position: 0px -450px;
      }
      #top_gnb > div.item_4.active {
        background-position: 0px -500px;
      }
      #top_gnb > div.item_5.active {
        background-position: 0px -550px;
      }
      #top_gnb > div.item_6.active {
        background-position: 0px -600px;
      }
      #top_gnb > div.item_7.active {
        background-position: 0px -650px;
      }
    </style>
    <!-- ๋„ค๋น„๊ฒŒ์ด์…˜_์•„๋ž˜ -->
    <style>
      #bottom_gnb {
        overflow: hidden;
      }

      #bottom_gnb > div.menu {
        float: left;
        width: 98px;
        height: 80px;
        background: url('Images/bottom_gnb.png');
      }

      #bottom_gnb > div.item_1 {
        background-position: 0px 0px;
      }
      #bottom_gnb > div.item_2 {
        background-position: 0px -80px;
      }
      #bottom_gnb > div.item_3 {
        background-position: 0px -160px;
      }
      #bottom_gnb > div.item_4 {
        background-position: 0px -240px;
      }
      #bottom_gnb > div.item_5 {
        background-position: 0px -320px;
      }
      #bottom_gnb > div.item_6 {
        background-position: 0px -400px;
      }
      #bottom_gnb > div.item_7 {
        background-position: 0px -480px;
      }
      #bottom_gnb > div.item_8 {
        background-position: 0px -560px;
      }
      #bottom_gnb > div.item_9 {
        background-position: 0px -640px;
      }
      #bottom_gnb > div.item_10 {
        background-position: 0px -720px;
      }

      #bottom_gnb > div.item_1:hover {
        background-position: 0px -800px;
      }
      #bottom_gnb > div.item_2:hover {
        background-position: 0px -880px;
      }
      #bottom_gnb > div.item_3:hover {
        background-position: 0px -960px;
      }
      #bottom_gnb > div.item_4:hover {
        background-position: 0px -1040px;
      }
      #bottom_gnb > div.item_5:hover {
        background-position: 0px -1120px;
      }
      #bottom_gnb > div.item_6:hover {
        background-position: 0px -1200px;
      }
      #bottom_gnb > div.item_7:hover {
        background-position: 0px -1280px;
      }
      #bottom_gnb > div.item_8:hover {
        background-position: 0px -1360px;
      }
      #bottom_gnb > div.item_9:hover {
        background-position: 0px -1440px;
      }
      #bottom_gnb > div.item_10:hover {
        background-position: 0px -1520px;
      }

      #bottom_gnb > div.item_1.active {
        background-position: 0px -800px;
      }
      #bottom_gnb > div.item_2.active {
        background-position: 0px -880px;
      }
      #bottom_gnb > div.item_3.active {
        background-position: 0px -960px;
      }
      #bottom_gnb > div.item_4.active {
        background-position: 0px -1040px;
      }
      #bottom_gnb > div.item_5.active {
        background-position: 0px -1120px;
      }
      #bottom_gnb > div.item_6.active {
        background-position: 0px -1200px;
      }
      #bottom_gnb > div.item_7.active {
        background-position: 0px -1280px;
      }
      #bottom_gnb > div.item_8.active {
        background-position: 0px -1360px;
      }
      #bottom_gnb > div.item_9.active {
        background-position: 0px -1440px;
      }
      #bottom_gnb > div.item_10.active {
        background-position: 0px -1520px;
      }
    </style>
    <!-- ๋ชฉ๋ก -->
    <style>
      /* ๐ŸŒŸ ์ž์† ํƒœ๊ทธ์— float ์†์„ฑ์„ ์ ์šฉํ•˜๋ฉด ๋ถ€๋ชจ ํƒœ๊ทธ์— overflow: hidden; ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ’ฏ */
      #detail_list {
        overflow: hidden;
        padding: 10px;
        background: #3b414d;
        padding-bottom: 15px;
      }

      #detail_list > ul {
        float: left;
        width: 192px;
      }

      #detail_list > ul > li {
        height: 13px;
        margin-top: 5px;
        padding: 3px 5px;
        color: #f3f3f3;

        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #detail_list > ul > li.header {
        padding-left: 15px;
      }

      #detail_list > ul > li.header > p {
        font-weight: bold;
        color: #48c5ff;
      }
    </style>
    <!-- ๋ณธ๋ฌธ -->
    <style>
      #content {
        margin-top: 10px;
      }
      #product_section {
        overflow: hidden;
        margin-top: 5px;
      }

      #product_section > #product_article {
        float: left;
        width: 795px;
      }

      #product_section > #product_aside {
        float: right;
        padding-bottom: 5px;
        width: 170px;
      }
      #product_section > #product_article > img {
        display: block;
      }
    </style>
    <!-- ํ‘ธํ„ฐ -->
    <style>
      #main_footer {
        height: 40px;
        padding: 10px;
        margin-bottom: 10px;

        background: #9c9c9c;
        border-radius: 5px;

        text-align: center;
      }

      #main_footer > h1 {
        font-size: 1.5em;
        font-weight: bold;
      }

      #main_footer > h2 {
        font-size: 1.2em;
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <header id="main_header">
      <h1 class="logo">
        <a href="#"><img src="Images/title.png" /></a>
      </h1>
      <div class="login_menu">
        <span><a href="#">๋กœ๊ทธ์ธ</a></span>
        <span><a href="#">ํšŒ์›๊ฐ€์ž…</a></span>
        <span><a href="#">๊ณ ๊ฐ์„ผํ„ฐ</a></span>
      </div>
    </header>
    <aside id="global_aside">
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
      <a><img src="http://placehold.it/90x160" /></a>
    </aside>
    <nav id="top_gnb">
      <div class="menu item_1 active"></div>
      <div class="menu item_2"></div>
      <div class="menu item_3"></div>
      <div class="menu item_4"></div>
      <div class="menu item_5"></div>
      <div class="menu item_6"></div>
      <div class="menu item_7"></div>
    </nav>
    <nav id="bottom_gnb">
      <div class="menu item_1"></div>
      <div class="menu item_2"></div>
      <div class="menu item_3"></div>
      <div class="menu item_4"></div>
      <div class="menu item_5"></div>
      <div class="menu item_6"></div>
      <div class="menu item_7"></div>
      <div class="menu item_8"></div>
      <div class="menu item_9 active"></div>
      <div class="menu item_10"></div>
    </nav>
    <div id="detail_list">
      <ul class="column_1">
        <li class="header"><p>๊ฒŒ์ž„์šฉ ๋…ธํŠธ๋ถ</p></li>
        <li>์•„์ด์˜จ ๊ฒŒ์ž„์šฉ ๋…ธํŠธ๋ถ</li>
        <li>๋””์•„๋ธ”๋กœ ๊ฒŒ์ž„์šฉ ๋…ธํŠธ๋ถ</li>
        <li>๋ธ”์†Œ ๊ฒŒ์ž„์šฉ ๋…ธํŠธ๋ถ</li>
        <li class="header"><p>์šธํŠธ๋ผ๋ถ</p></li>
        <li>ํ—ฌ๋กœํ‚คํ‹ฐ ์šธํŠธ๋ผ๋ถ</li>
        <li>๋ฆฌ๋ฝ์ฟ ๋งˆ ์šธํŠธ๋ผ๋ถ ์ดˆํŠน๊ฐ€</li>
        <li>์นดํ”ผ๋ฐ”๋ผ ์šธํŠธ๋ผ๋ถ</li>
        <li>์ตธํŒŒ ์šธํŠธ๋ผ๋ถ</li>
        <li>๊ณ ์–‘์ด ์šธํŠธ๋ผ๋ถ</li>
      </ul>
      <ul class="column_2">
        <li>๋‘˜๋ฆฌ ์šธํŠธ๋ผ๋ถ</li>
        <li class="header"><p>๋…ธํŠธ๋ถ ๊ฐ€๋ฐฉ</p></li>
        <li>์†œ์‚ฌํƒ• ๋ธŒ๋žœ๋“œ ๋…ธํŠธ๋ถ ๊ฐ€๋ฐฉ</li>
        <li>๋ณด๋…ธ๋ณด๋…ธ ๊ฐ€๋ฐฉ</li>
        <li>๋ž‘์ฝค ๊ฐ€๋ฐฉ</li>
        <li class="header"><p>๋ฐ›์นจ๋Œ€/์ฟจ๋Ÿฌ</p></li>
        <li>์•„์ด๋ฐ”๋„ค์ฆˆ ๋ฐ›์นจ๋Œ€</li>
        <li>๊น์Šจ ์ฟจ๋Ÿฌ</li>
        <li>ํ—ค๋ผํด๋ ˆ์Šค ์‚ผ๊ฐ ๋ฐ›์นจ๋Œ€</li>
        <li>ํŽœ๋” ์ŠคํŠธ๋ผํ† ์บ์Šคํ„ฐ ์ฟจ๋Ÿฌ</li>
      </ul>
      <ul class="column_3">
        <li class="header"><p>๋…ธํŠธ๋ถ ๋ณดํ˜ธ ์šฉํ’ˆ</p></li>
        <li>Node.js ๋ฐฉ์—ด ๋ณดํ˜ธํŒ</li>
        <li>์•ˆ๋“œ๋กœ์ด๋“œ</li>
        <li>์ดˆํŠน๊ฐ€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๋ณดํ˜ธ๋Œ€</li>
        <li>๊ธฐ๊ณ„ ํ•™์Šต์„ ์‚ฌ์šฉํ•œ ๋ณดํ˜ธ๋Œ€</li>
        <li class="header"><p>๋งฅ๋ถ</p></li>
        <li>์›๊ณ ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๋งฅ๋ถ ์—์–ด</li>
        <li>๋ ˆํ‹ฐ๋‚˜ ๋””์Šคํ”Œ๋ ˆ์ด</li>
        <li class="header"><p>๋…ธํŠธ๋ถ ๋ณดํ˜ธ ์šฉํ’ˆ</p></li>
        <li>๋ฌผ๊ฑด ์ด๋ฆ„ ๋งŒ๋“ค๊ธฐ ํž˜๋“ค์–ด</li>
      </ul>
      <ul class="column_4">
        <li>์šฐ์ฃผ ๋ฐฉ์‚ฌ๋Šฅ ๋ณดํ˜ธ ์ฝ”ํŒ…์ œ</li>
        <li>์ž์ฒด ์ค‘๋ ฅ ์ƒ์„ฑ ์žฅ์น˜</li>
        <li>์ดˆํŠน๊ฐ€</li>
        <li>๋…ธํŠธ๋ถ ํˆฌ๋ช…ํ™” ์Šคํ”„๋ ˆ์ด</li>
        <li>๊ณ ์•• ์ „๋ฅ˜</li>
        <li class="header"><p>๋…ธํŠธ๋ถ ๋ณด์กฐ ์šฉํ’ˆ</p></li>
        <li>์ดˆํŠน๊ฐ€</li>
        <li>๊ณต๊ฐ„ ๊ท ์—ด ์žฅ์น˜</li>
        <li>ํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“œ๋Š” ํ”„๋กœ๊ทธ๋žจ</li>
        <li>์ดˆํŠน๊ฐ€</li>
      </ul>
      <ul class="column_5">
        <li>๋ฏธ์˜ค ๋ฒ ์ด์Šค ์žฅ์น˜</li>
        <li>๊ณต๊ฐ„์„ ์ง€๋ฐฐํ•˜๋Š”์ž</li>
        <li>ํ˜„๊ธˆ ํ• ์ธ</li>
        <li class="header"><p>์™ธ์žฅ ํ•˜๋“œ ๋””์Šคํฌ</p></li>
        <li>ํ† ์‹œ๋ฐ” 500GB ์™ธ์žฅ ํ•˜๋“œ</li>
        <li>์ดˆ๊ณต๊ฐ„ ํ†ตํ•ฉ ๋ฌดํ•œ ๋ฉ”๋ชจ๋ฆฌ</li>
        <li>๋ชจ๋˜ ์›น์„ ์œ„ํ•œ Node.js ํ”„๋กœ๊ทธ๋ž˜๋ฐ</li>
        <li>๋ชจ๋˜ ์›น์„ ์œ„ํ•œ JavaScript + jQuery ์ž…๋ฌธ</li>
        <li>์œค์ธ์„ฑ</li>
        <li>์ด๋ฆ„ ๋งŒ๋“ค๊ธฐ ํž˜๋“ค์–ด์š”</li>
      </ul>
    </div>
    <div id="content">
      <figure id="product_image">
        <img src="http://placehold.it/980x440" />
      </figure>
      <section id="product_section">
        <article id="product_article">
          <img src="http://placehold.it/795x400" />
          <img src="http://placehold.it/795x400" />
          <img src="http://placehold.it/795x400" />
        </article>
        <aside id="product_aside">
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
          <a href="#"><img src="http://placehold.it/170x200" /></a>
        </aside>
      </section>
    </div>
    <footer id="main_footer">
      <h1>๋ชจ๋˜ ์›น ๋””์ž์ด๋„ˆ๋ฅผ ์œ„ํ•œ HTML5 + CSS3 ์ž…๋ฌธ</h1>
    </footer>
  </body>
</html>

๐Ÿ“• ์ •๋ฆฌ

  • width์™€ margin: 0 auto;๋ฅผ ์ด์šฉํ•˜์—ฌ body ํƒœ๊ทธ ์ค‘์•™ ์ •๋ ฌํ•˜๊ธฐ
  • ์ž์† ํƒœ๊ทธ์— position: absolute; ์ ์šฉ ์‹œ, ๋ถ€๋ชจ ํƒœ๊ทธ์— position: relative; ์ ์šฉํ•˜๊ธฐ
  • ์ž์† ํƒœ๊ทธ์— float ์†์„ฑ ์ ์šฉ ์‹œ, ๋ถ€๋ชจ ํƒœ๊ทธ์— overflow: hidden; ์ ์šฉํ•˜๊ธฐ
  • ์Šคํ”„๋ผ์ดํŠธ ์ด๋ฏธ์ง€์™€ background-position์— ๋Œ€ํ•œ ์ดํ•ด