
โญ๏ธ ์นด๋ ์ ํ 03 โญ๏ธ
01. ๋ ์ด์์ ๊ตฌ์ํ๊ธฐ
๋ ์ด์์์ ๊ตฌ์ํ ๋๋, ์ค์ผ์นํ๋ฉด์ ์ธ๋ถ ๋ด์ฉ์ ์ ๋ณด๊น์ง ๊ตฌ์ฒด์ ์ผ๋ก ๊ณํํฉ๋๋ค.

02. ๊ธฐ๋ณธ ์์(div) ๋ง๋ค๊ธฐ : <body>
section ์ ์๋ฉํฑ ๋งํฌ์
ํ๊ณ , id ๋ก ์ด๋ฆ์ ์ง์ด์ค๋๋ค.
์นด๋ ์์ 3๊ฐ(article)์ ๋ง๋ค๊ณ , ์ ๋ชฉ๊ณผ ๋ด์ฉ์ ์
๋ ฅํฉ๋๋ค.
์ค๊ฐ ์ค๊ฐ์ ๋ธ๋ผ์ฐ์ ๋ฅผ ์ดํด๋ณด๋ฉฐ ์ ๋ง๋ค์ด์ง๊ณ ์๋์ง ํ์ธํ๋ ๊ณผ์ ์ด ํ์ํฉ๋๋ค.
<section id="cardType03"> // <section>๊ณผ ๊ฐ์ด ์๋ฉํฑ ๋งํฌ์
์ ํ๋ฉด ์ ๋ชฉ์ ๋ฐ๋์ ์ ์ด์ค์ผ ํ๋ฏ๋ก <h2>๋ฅผ ์์ฑํฉ๋๋ค. (์ดํ ๋์ ๋ณด์ด์ง ์๋๋ก ์จ๊ฒจ๋๊ธฐ) <h2>ํ ํธ ๊ณต์ ํ๊ธฐ</h2> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> </section>
02. ๊ธฐ๋ณธ style(css) ์ค์ ํ๊ธฐ : <style>
/* font */ @import url('https://webfontworld.github.io/score/SCoreDream.css'); .score { /* ์ ์ฒด ๊ธ์ ์ค์ */ font-family: 'SCoreDream'; font-weight: 300; /* ๊ธฐ๋ณธ ๊ธ์ ๋๊ป*/ } /* reset */ * { /* ๋ธ๋ผ์ฐ์ ๊ธฐ๋ณธ ์ฌ๋ฐฑ ์์ ๊ธฐ */ margin: 0; padding: 0; } a { text-decoration: none; /* ํ๋์ ๋ฐ์ค๋ก ๋ณด์ด๋ a ๋งํฌ์ ๊ธฐ๋ณธ ์ค์ ๋ฐ๊พธ๊ธฐ */ color: #000; } img { width: 100%; /* ์ด๋ฏธ์ง ํ์ผ๋ ๋ค์ด๊ฐ๋ฏ๋ก ๋๋น 100%๋ก ์ค์ ํด๋์ */ } h1, h2, h3, h4, h5, h6 { /* ๊ตต๊ฒ ์ค์ ๋์ด ์๋ ๊ธฐ๋ณธ ๊ธ์ ๋๊ป๋ฅผ ๋ณดํต ๊ตต๊ธฐ๋ก ๋ฐ๊พธ๊ธฐ */ font-weight: normal; }
03. ๋ ์ด์์์ ํฐ ํ์ ์ ํ์ ์ค์ : <body>
<section id="cardType03" class="card__wrap score section"> // ์ ์ฒด ๊ธ์ ์ค์ ๋ฐ ๊ฒฝ๋ก ํ์
์ ์ํ ์ ํ์ ์ด๋ฆ ์
๋ ฅ <div class="card__inner container"> // ์นด๋ ์์ 3๊ฐ ๋ฌถ์. ์ ์ฒด container ์ ํ์ ์ด๋ฆ๋ก ๊ทธ๋ฃนํ <h2>ํ ํธ ๊ณต์ ํ๊ธฐ</h2> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> <article calss="card"> <h3>์นด๋ ์ ๋ชฉ</h3> <p>์นด๋ ๋ด์ฉ</p> </article> </div> </section>
04. ๋ ์ด์์์ ํฐ ํ css ์ค์ : <style>
/* common : ๋ค๋ฅธ ํ์ด์ง์์๋ ๊ณตํต์ ์ผ๋ก ์ฌ์ฉํ๋ css ํจ๋ถ๋ก ์์ ๋ถ๊ฐ*/ .container { /* ์นด๋ ์์ 3๊ฐ๋ฅผ ๋ชจ๋ ๋ฌถ๋ ํฐ ์์ */ width: 1160px; /* ํฐ ์์ ๋๋น ์ค์ : ๋ ์ด์์ ์ค์ผ์น์ ์์น ํ์ธ */ padding: 0 20px; /* ์ํ ์ฌ๋ฐฑ ์ค์ */ margin: 0 auto; /* ์ค์ ์ ๋ ฌ */ min-width: 1160; } .section { padding: 120px 0; /* ์ข์ฐ ์ฌ๋ฐฑ ์ค์ */ } .section > h2 { /* section ์ ๋ฐ๋ก ๋ฐ์ ์์์ธ h2 ์๋ง ์ ์ฉ */ font-size: 50px; line-height: 1; /* ์ค๊ฐ๊ฒฉ */ text-align: center; /* ๊ธ์ ์ค์ ์ ๋ ฌ */ margin-bottom: 20px; /* ๋ฐ ์ฌ๋ฐฑ ์ค์ */ } .section > p { font-size: 22px; font-weight: 300; color: #666; text-align: center; margin-bottom: 70px; } /* cardType03 */ body { background-color: #2254c3; /* ๋ธ๋ผ์ฐ์ ๋ฐฐ๊ฒฝ์ */ } .card__inner { display: flex; /* ์นด๋ ๊ฐ๋ก ์ ๋ ฌ */ } .card__inner .card { width: 33.3333%; /* ๋๋น ๋น์จ */ padding: 26px; /* container์ ์นด๋ ์ฌ์ด์ ์ฌ๋ฐฑ */ background-color: #fff; } .card__inner .card:nth-child(1) { border-right: 1px solid #eee; /* ์นด๋ ์ฌ์ด์ ์ ์ ๋ง๋ค๊ธฐ */ } .card__inner .card:nth-child(2) { border-right: 1px solid #eee; }
05. ์ธ๋ถ ์์ / ๊ทธ๋ฃนํ ๋ฐ class ๋ก ์ด๋ฆ ์ค์ : <body>
๋ ์ด์์์ ๊ตฌ์ฑํ๋ ์ด๋ฏธ์ง, ์ฌ์ฉ์ ์ด๋ฆ ๋ฑ์ ๋ํ ๋ด์ฉ์ ๋ด๋ ๋ชจ๋ ์์๋ฅผ ์๊ฐํ๊ณ ๊ทธ๋ฃนํ ํฉ๋๋ค.
๊ทธ๋ฃนํ ๊ณผ์ ์์๋ style (css) ์ ์ฉ์ ์ํด, class ๋ก ๊ฒน์น์ง ์๋ ์ด๋ฆ์ ์ค์ ํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. โ ์ ํ์
<section id="cardType03" class="card__wrpa score section"> <h2 class="blind">ํ ํธ ๊ณต์ ํ๊ธฐ</h2> // css ์์ ๋์ ๋ณด์ด์ง ์๊ฒ ์จ๊ฒจ๋๊ธฐ ์ํด ์ด๋ฆ ์ค์ <div class="card__inner container"> <article class="card"> <figure class="card__header"> // ์นด๋ ์์์ ์๋จ์ ๊ตฌ์ฑํ๋ ํฐ ์ด๋ฏธ์ง์ ์๋จ ์ค๋ฅธ์ชฝ์ ์์นํ ์์(span) ๊ทธ๋ฃนํ. <img src="img/card_bg03_01.jpg" alt="๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ"> // ์ด๋ฏธ์ง ๋ฃ๊ณ , W3C ์ค์๋ฅผ ์ํด alt ๋ด์ฉ ์
๋ ฅ <figcaption>ํ ํธ ๊ณต์</figcaption> // ๋ฐ์ ์ด๋ฏธ์ง span ๊ณผ ๊ฒน์น๋ฏ๋ก figcaption ๋ก ์๋ฉํด ๋งํฌ์
</figure> <div class="card__contents"> // ์นด๋ ์์์ ์ค๊ฐ์ ๋ค์ด๊ฐ๋ ์ ๋ชฉ๊ณผ ๋ด์ฉ์ ๊ทธ๋ฃนํ <h3>ํ ํธ ๊ณต์ : ๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด์์! ์์๋ณด์์! ์์๋ณด์์!</h3> // ์ค ๋๊น ํจ๊ณผ๋ฅผ ๋ณด๊ธฐ ์ํด ๊ธธ๊ฒ ์
๋ ฅ <p>๋ฒํผํ ์คํฐ์น๋ ํ ํธ์ง ๋ ์ฅ์ ๋ง๋์ด ๋ฐ๋์งํ๊ฑฐ๋ ํ ํธ์ง ๋๋ ๋ฅผ ์ ๋ฆฌํ ๋ ์ฌ์ฉ๋๋ ๋ฐ๋์ง ๋ฐฉ๋ฒ์
๋๋ค. 1. ๋งค๋ญ์ด ๋ณด์ด์ง ์๊ฒ ํ ํธ์ง ์์ชฝ์์ ์์ํ์ฌ ๋ฐ๋์ ํต๊ณผ์ํต๋๋ค.</p> </div> <div class="card__footer"> // ์นด๋ ์์์ ํ๋จ์ ๊ตฌ์ฑํ๋ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ๋ด์ฉ ๋ฐ ์ด๋ฏธ์ง ๊ทธ๋ฃนํ <h4>๋ฐ๋์งํ๊ธฐ ์ข์๋ <em>1์ผ ์ </em></h4> <span><img src="img/card_bg03_icon01.png" alt="์ฌ์ฉ์ : ๋ฐ๋์งํ๊ธฐ ์ข์๋ "></span> </div> </article> <article class="card"> // * ๋ณต์ฌ : ์์ ์นด๋ ํ๋๋ฅผ ๋ ๋ฒ ๋ณต์ฌํ๊ณ ๋์ ์ธ๋ถ ๋ด์ฉ ๋ฐ๊พธ๊ธฐ <figure class="card__header"> <img src="img/card_bg03_01.jpg" alt="๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ"> <figcaption>ํ ํธ ๊ณต์</figcaption> </figure> <div class="card__contents"> <h3>ํ ํธ ๊ณต์ : ๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด์์! ์์๋ณด์์! ์์๋ณด์์!</h3> <p>๋ฒํผํ ์คํฐ์น๋ ํ ํธ์ง ๋ ์ฅ์ ๋ง๋์ด ๋ฐ๋์งํ๊ฑฐ๋ ํ ํธ์ง ๋๋ ๋ฅผ ์ ๋ฆฌํ ๋ ์ฌ์ฉ๋๋ ๋ฐ๋์ง ๋ฐฉ๋ฒ์
๋๋ค. 1. ๋งค๋ญ์ด ๋ณด์ด์ง ์๊ฒ ํ ํธ์ง ์์ชฝ์์ ์์ํ์ฌ ๋ฐ๋์ ํต๊ณผ์ํต๋๋ค.</p> </div> <div class="card__footer"> <h4>๋ฐ๋์งํ๊ธฐ ์ข์๋ <em>1์ผ ์ </em></h4> <span><img src="img/card_bg03_icon01.png" alt="์ฌ์ฉ์ : ๋ฐ๋์งํ๊ธฐ ์ข์๋ "></span> </div> </article> <article class="card"> // * ๋ณต์ฌ <figure class="card__header"> <img src="img/card_bg03_01.jpg" alt="๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ"> <figcaption>ํ ํธ ๊ณต์</figcaption> </figure> <div class="card__contents"> <h3>ํ ํธ ๊ณต์ : ๋ฒํผํ ์คํฐ์น์ ๋ผ์๋ฐ๊ธฐ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด์์! ์์๋ณด์์! ์์๋ณด์์!</h3> <p>๋ฒํผํ ์คํฐ์น๋ ํ ํธ์ง ๋ ์ฅ์ ๋ง๋์ด ๋ฐ๋์งํ๊ฑฐ๋ ํ ํธ์ง ๋๋ ๋ฅผ ์ ๋ฆฌํ ๋ ์ฌ์ฉ๋๋ ๋ฐ๋์ง ๋ฐฉ๋ฒ์
๋๋ค. 1. ๋งค๋ญ์ด ๋ณด์ด์ง ์๊ฒ ํ ํธ์ง ์์ชฝ์์ ์์ํ์ฌ ๋ฐ๋์ ํต๊ณผ์ํต๋๋ค.</p> </div> <div class="card__footer"> <h4>๋ฐ๋์งํ๊ธฐ ์ข์๋ <em>1์ผ ์ </em></h4> <span><img src="img/card_bg03_icon01.png" alt="์ฌ์ฉ์ : ๋ฐ๋์งํ๊ธฐ ์ข์๋ "></span> </div> </article> </div>
06. ์ธ๋ถ css ์ค์ : <style>
์นด๋ ์๋จ css
.card {} .card__header { position: relative; /* ๋๋ฒ์งธ, ์นด๋์ ์ค๋ฅธ์ชฝ ๋ชจ์๋ฆฌ์ชฝ์ผ๋ก ์์น ๊ณ ์ ํ ๊ธฐ์ค์ ์ค์ */ } .card__header img { border-radius: 10px; box-shadow: 4px 4px 5px 0 rgba(0, 0, 0, 0.05); margin-bottom: 20px; } .card__header figcaption { position: absolute; /* ์ฒซ๋ฒ์จฐ, ์นด๋์ ์ค๋ฅธ์ชฝ ๋ชจ์๋ฆฌ์ชฝ์ผ๋ก ์์น ๊ณ ์ */ right: 10px; top: 10px; padding: 6px 16px; border-radius: 50px; /* ๊ณก๋ฅ ์ค์ */ background-color: #fff; text-align: center; font-size: 14px; color: #7b7b7b; }
์นด๋ ์ค๊ฐ ๋ด์ฉ css
.card__contents {} .card__contents h3 { font-size: 20px; line-height: 1.4; margin-bottom: 10px; overflow: hidden; /* ์ค ๋๊น ํจ๊ณผ */ text-overflow: ellipsis; /* ์ค ๋๊น ํจ๊ณผ */ display: -webkit-box; /* ์ค ๋๊น ํจ๊ณผ */ -webkit-line-clamp: 2; /* ์ค ๋๊น ํจ๊ณผ */ -webkit-box-orient: vertical; /* ์ค ๋๊น ํจ๊ณผ */ } .card__contents p { color: #666; font-size: 16px; line-height: 1.7; margin-bottom: 30px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
์นด๋ ํ๋จ css
.card__footer { display: flex; justify-content: flex-end; /* display: flex;์ ์ํ ๋ฐฉํฅ ์ ๋ ฌ ๋ฐฉ์*/ } .card__footer h4 { text-align: right; color: #DD2A2A; } .card__footer em { display: block; color: #666; font-style: normal; /* ๊ธ์ ๊ธฐ์ธ๊ธฐ ์์ ๊ธฐ */ } .card__footer span { width: 40px; height: 40px; background: #000; border-radius: 50%; overflow: hidden; display: block; margin-left: 10px; margin-top: -3px; /* margin ๋ง - ๋ก ์ค์ ๊ฐ๋ฅ */ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05); /* ๊ทธ๋ฆผ์ ๋ฃ๊ธฐ */ }
03. ๊ฒฐ๊ณผ๋ณด๊ธฐ
'CSS > Layout_Site' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ด๋ฏธ์ง ์ ํ (3) (2) | 2022.08.22 |
---|---|
์ด๋ฏธ์ง ์ ํ (2) (2) | 2022.08.18 |
์ด๋ฏธ์ง ์ ํ (1) (4) | 2022.08.17 |
์นด๋ ์ ํ (2) (7) | 2022.08.10 |
์นด๋ ์ ํ (1) (8) | 2022.08.09 |
๋๊ธ