๐ 1-1. ๊ฐ๋ ๋ถํฐ! โ์น ํ์ด์ง๋ ์ง์ด๋ค!โ ๐
๐ ๊ตฌ์ฑ ์์ | ๐ HTML ์๋งจํฑ ํ๊ทธ | ๐ฌ ๋น์ | ๐ฅ ์ฌํ |
---|---|---|---|
์๋จ(Header) | <header> |
ํ๊ด๋ฌธ & ๊ฐํ ๐ | ๋ก๊ณ , ๋ด๋น๊ฒ์ด์ , ๊ฒ์๋ฐ ํฌํจ. SEO์ ์ ๊ทผ์ฑ์์ ์ค์ํ ์ญํ |
๋ฉ๋ด(Navigation) | <nav> |
์๋ดํ์ํ ๐บ๏ธ | ARIA ์์ฑ๊ณผ ํจ๊ป ์ฌ์ฉํ๋ฉด ์คํฌ๋ฆฐ๋ฆฌ๋์์ ๋ ์ข์ |
๋ฉ์ธ ์ฝํ ์ธ (Main) | <main> , <section> |
๊ฑฐ์ค, ๋ฐฉ ๐๏ธ | ํ์ด์ง์ ํ๋๋ง ์กด์ฌํด์ผ ํจ. ํต์ฌ ์ฝํ ์ธ ๋ง ํฌํจ |
๊ธ, ๊ธฐ์ฌ(Article) | <article> |
์ฑ ์ ์ ์ ๋ฌธ ๐ | ๋ ๋ฆฝ์ ์ผ๋ก ๋ฐฐํฌ ๊ฐ๋ฅํ ์ฝํ ์ธ (RSS ํผ๋ ๋์) |
์ฌ์ด๋๋ฐ(Aside) | <aside> |
๋ฒฝ์ฅ, ์๋ฉ๊ณต๊ฐ ๐๏ธ | ๊ด๋ จ ์ฝํ ์ธ , ๊ด๊ณ , ์ถ์ฒ ๊ธ ๋ฑ ๋ณด์กฐ ์ ๋ณด |
ํ๋จ(Footer) | <footer> |
์ง๋ช ํจ & ์ฐ๋ฝ์ฒ ๐ | ์ ์๊ถ ์ ๋ณด, ์ฌ์ดํธ ๋งต, ์ฐ๋ฝ์ฒ, ํ๋จ ๋ฉ๋ด |
โจ 1-2. ๊ธฐ๋ณธ HTML + CSS: ์ฃผ์ ํฌํจ
<!-- ๊ธฐ๋ณธ ๋ ์ด์์ -->
<body>
<header>๐ MySite</header> <!-- ์ฌ์ดํธ ์๋จ -->
<nav> <!-- ๋ด๋น๊ฒ์ด์
-->
Home | About | Contact
</nav>
<main> <!-- ๋ฉ์ธ ์ฝํ
์ธ -->
<section>
<article>
<h2>๐ Welcome!</h2>
<p>Main content goes here.</p>
</article>
</section>
<aside>๐ข Ads, Sidebar content</aside> <!-- ๋ณด์กฐ ์ฝํ
์ธ -->
</main>
<footer>ยฉ 2025 MySite</footer> <!-- ํ๋จ -->
</body>
/* Header์ Footer ์คํ์ผ */
header, footer {
background: #333; color: white; padding: 1rem; text-align: center;
}
/* ๋ด๋น๊ฒ์ด์
๋ฐ */
nav {
background: #555; color: white; padding: 1rem; text-align: center;
}
/* ๋ฉ์ธ ์ฝํ
์ธ ์์ญ */
main {
display: flex; /* ๊ฐ๋ก ์ ๋ ฌ */
gap: 1rem; /* ์์ ์ฌ์ด ์ฌ๋ฐฑ */
padding: 1rem;
}
/* ์ฌ์ด๋๋ฐ */
aside {
width: 200px; /* ๊ณ ์ ํญ */
background: #f0f0f0;
padding: 1rem;
}
๐๏ธ 1-3. ์ค๋ฌด: Grid + Flex ์ฝค๋ณด๋ก ๋ ์ด์์ ๊ฐํ
/* ๋ฉ์ธ ๋ ์ด์์์ Grid๋ก */
.main-container {
display: grid;
grid-template-columns: 3fr 1fr; /* ์ฝํ
์ธ 3, ์ฌ์ด๋๋ฐ 1 ๋น์จ */
gap: 1rem;
}
/* ๋ด๋น๊ฒ์ด์
์ Flex๋ก ์ ๋ ฌ */
nav {
display: flex;
justify-content: space-around; /* ๋ฉ๋ด๋ฅผ ์ข์ฐ๋ก ๊ณ ๋ฅด๊ฒ */
}
๐ ์ Grid + Flex๋ฅผ ๊ฐ์ด ์จ?
- Grid: ์ ์ฒด ๊ตฌํ(ํ์ด์ง ํ) โ Excel์ฒ๋ผ 2D
- Flex: ๋ด๋ถ ์ ๋ ฌ (๊ฐ๋ก/์ธ๋ก) โ ๋ฉ๋ด, ๋ฒํผ ๋ฐฐ์น ์ต์ !
๐ฑ 1-4. ์ฌํ: ๋ฐ์ํ + Sticky Header ์ ์ฉ
/* ์คํฌ๋กคํด๋ header๊ฐ ๊ณ ์ ๋จ */
header {
position: sticky;
top: 0;
background: #222;
z-index: 1000; /* ๋ค๋ฅธ ์์ ์์ ํ์ */
}
/* ๋ชจ๋ฐ์ผ ํ๋ฉด ๋์ */
@media (max-width: 768px) {
.main-container {
grid-template-columns: 1fr; /* ํ ์ด๋ก ๋ณ๊ฒฝ */
}
nav {
flex-direction: column; /* ๋ฉ๋ด ์ธ๋ก ์ ๋ ฌ */
}
}
๐จ 1-5. ์ฌํ: CSS ๋ณ์๋ก Theme ๋ณ๊ฒฝ ์ฝ๊ฒ!
:root {
--main-color: #3498db; /* ๊ธฐ๋ณธ ์์ */
--accent-color: #f39c12; /* ๊ฐ์กฐ ์์ */
}
header {
background: var(--main-color); /* ๋ณ์ ์ฌ์ฉ */
}
button:hover {
background: var(--accent-color); /* ๋ฒํผ ๊ฐ์กฐ ํจ๊ณผ */
}
์ฅ์ โ: ์์ ๋ฐ๊ฟ ๋ ๋ณ์๋ง ์์ ํ๋ฉด ์ ์ฒด ํ ๋ง๊ฐ ๋ณ๊ฒฝ๋จ! ๋๊ท๋ชจ ํ๋ก์ ํธ ๊ด๋ฆฌ ํ์ ์คํฌ!
๐ 1-6. ๊ธฐ์ ๋ฉด์ ๋๋น ์ฌํ ์ง๋ฌธ
์ง๋ฌธ | ์ฌํ ๋ต๋ณ |
---|---|
Flex์ Grid ์ฐจ์ด? | Flex: 1D ์ ๋ ฌ (์ํ/์์ง ํ ๋ฐฉํฅ), Grid: 2D (ํ+์ด). ์ค๋ฌด๋ Grid๋ก ๋ ์ด์์, ๋ด๋ถ๋ Flex๋ก ์กฐํฉ |
์๋งจํฑ ํ๊ทธ ์ ์ค์ํ๊ฐ? | SEO ์ต์ ํ, ์คํฌ๋ฆฐ๋ฆฌ๋ ์ ๊ทผ์ฑ ํฅ์, ์ฝ๋ ๊ฐ๋ ์ฑ/์ ์ง๋ณด์์ฑ ์์น. ํ์ ์ ์๋ฏธ ๋ช ํํ ์ ๋ฌ ๊ฐ๋ฅ |
๋ฐ์ํ ์๋ฆฌ? | ๋ฏธ๋์ด์ฟผ๋ฆฌ + ์ ๋ ๋จ์(%/vw/rem) ์ฌ์ฉ, Mobile-First ์ ๊ทผ ์ ๋ต ์ถ์ฒ |