๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Site ์ œ์ž‘

03. ์นด๋“œ ์œ ํ˜• - 3

by Youcodein 2022. 8. 11.
728x90
๋ฐ˜์‘ํ˜•

์นด๋“œ์œ ํ˜• 3

์นด๋“œ ์œ ํ˜• ๋ ˆ์ด์•„์›ƒ ์‚ฌ์ดํŠธ์ž…๋‹ˆ๋‹ค. html๊ณผ css๋กœ ์ž‘์—…ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

๋ ˆ์ด์•„์›ƒ ์„ค์ •

figma๋กœ ๊ทธ๋ฆฌ๋“œ์™€ ์‚ฌ์ดํŠธ์˜ ๋ ˆ์ด์•„์›ƒ์„ ์žก์Šต๋‹ˆ๋‹ค.

HTML

html ์†Œ์Šค์ž…๋‹ˆ๋‹ค.

<body>
    <section id="cardType03" class="card__wrap SCore section">
        <h2 class="blind">๋‹ค์ด์–ด๋ฆฌ์˜ ์„ธ๊ณ„</h2>
        <div class="card__inner container">
            <article class="card">
                <figure class="card__header">
                    <img src="img/card_bg03_01.jpg" alt="๋‹ค์ด์–ด๋ฆฌ">
                    <figcaption>Write</figcaption>
                </figure>
                <div class="card__contents">
                    <h3>์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!
                    ์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!</h3>
                    <p>
                        ์ด๋ฏธ์ง€๊ฐ€ ์—†์–ด๋„ ๋ฉ‹์ง€๊ฒŒ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค. ๊ทธ๋ฆผ์„ ๊ทธ๋ฆฌ์ง€ ๋ชปํ•œ๋‹ค๊ณ  ํ•ด๋„,
                        ๋ณด์—ฌ์ค„ ์ด๋ฏธ์ง€๊ฐ€ ์—†๋‹ค๊ณ  ํ•ด๋„ ๊ฒ๋จน์ง€ ๋ง๊ณ  ๋‹ค์ด์–ด๋ฆฌ ๊พธ๋ฏธ๊ธฐ๋ฅผ ์‹œ๋„ํ•˜์„ธ์š” 
                        ์˜ˆ์˜๊ณ  ๋ฉ‹์ง„ ๋‹ค์ด์–ด๋ฆฌ๋กœ
                        ๋‹ค๋ฅธ์‚ฌ๋žŒ๋“ค์˜ ๋งˆ์Œ์„ ์‚ฌ๋กœ์žก์•„์š”
                    </p>
                </div>
                <div class="card__footer">
                    <h4>Writelove <em>9 Resources</em></h4>
                    <span><img src="img/card_bg03_icon01.png" alt="Writelove"></span>
                </div>
            </article>
            <article class="card">
                <figure class="card__header">
                    <img src="img/card_bg03_02.jpg" alt="๋‹ค์ด์–ด๋ฆฌ">
                    <figcaption>Write</figcaption>
                </figure>
                <div class="card__contents">
                    <h3>์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!
                    ์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!</h3>
                    <p>
                        ์ด๋ฏธ์ง€๊ฐ€ ์—†์–ด๋„ ๋ฉ‹์ง€๊ฒŒ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค. ๊ทธ๋ฆผ์„ ๊ทธ๋ฆฌ์ง€ ๋ชปํ•œ๋‹ค๊ณ  ํ•ด๋„,
                        ๋ณด์—ฌ์ค„ ์ด๋ฏธ์ง€๊ฐ€ ์—†๋‹ค๊ณ  ํ•ด๋„ ๊ฒ๋จน์ง€ ๋ง๊ณ  ๋‹ค์ด์–ด๋ฆฌ ๊พธ๋ฏธ๊ธฐ๋ฅผ ์‹œ๋„ํ•˜์„ธ์š” 
                        ์˜ˆ์˜๊ณ  ๋ฉ‹์ง„ ๋‹ค์ด์–ด๋ฆฌ๋กœ
                        ๋‹ค๋ฅธ์‚ฌ๋žŒ๋“ค์˜ ๋งˆ์Œ์„ ์‚ฌ๋กœ์žก์•„์š”
                    </p>
                </div>
                <div class="card__footer">
                    <h4>Writelove <em>9 Resources</em></h4>
                    <span><img src="img/card_bg03_icon02.png" alt="Writelove"></span>
                </div>
            </article>
            <article class="card">
                <figure class="card__header">
                    <img src="img/card_bg03_03.jpg" alt="๋‹ค์ด์–ด๋ฆฌ">
                    <figcaption>Write</figcaption>
                </figure>
                <div class="card__contents">
                    <h3>์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!์†๊ธ€์”จ๋ฅผ ์ด์šฉํ•˜์—ฌ 
                    ๋‹น์‹ ์˜ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ์˜ˆ์˜๊ฒŒ ๊พธ๋ฉฐ๋ณด์„ธ์š”!</h3>
                    <p>
                        ์ด๋ฏธ์ง€๊ฐ€ ์—†์–ด๋„ ๋ฉ‹์ง€๊ฒŒ ๋‹ค์ด์–ด๋ฆฌ๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค. ๊ทธ๋ฆผ์„ ๊ทธ๋ฆฌ์ง€ ๋ชปํ•œ๋‹ค๊ณ  ํ•ด๋„,
                        ๋ณด์—ฌ์ค„ ์ด๋ฏธ์ง€๊ฐ€ ์—†๋‹ค๊ณ  ํ•ด๋„ ๊ฒ๋จน์ง€ ๋ง๊ณ  ๋‹ค์ด์–ด๋ฆฌ ๊พธ๋ฏธ๊ธฐ๋ฅผ ์‹œ๋„ํ•˜์„ธ์š” 
                        ์˜ˆ์˜๊ณ  ๋ฉ‹์ง„ ๋‹ค์ด์–ด๋ฆฌ๋กœ
                        ๋‹ค๋ฅธ์‚ฌ๋žŒ๋“ค์˜ ๋งˆ์Œ์„ ์‚ฌ๋กœ์žก์•„์š”
                    </p>
                </div>
                <div class="card__footer">
                    <h4>Writelove <em>9 Resources</em></h4>
                    <span><img src="img/card_bg03_icon03.png" alt="Writelove"></span>
                </div>
            </article>
        </div>
    </section>
</body>

CSS

css ์†Œ์Šค์ž…๋‹ˆ๋‹ค. figma๋กœ ์„ค์ •ํ•ด๋†“์€ ๋ ˆ์ด์•„์›ƒ์ด๋‚˜ zaplin์„ ๋ณด๋ฉฐ ์ ์ ˆํ•˜๊ฒŒ css๋ฅผ ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค.

/* font */
@import url('https://webfontworld.github.io/score/SCoreDream.css');

.SCore {
    font-family: SCoreDream;
    font-weight: 300;
}

body {}

/* reset */
* {
    margin: 0;
    padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: normal;
}

a {
    text-decoration: none;
    color: #000;
}

img {
    width: 100%;
}

/* common */
.container {
    width: 1160px;
    padding: 0 20px;
    margin: 0 auto;
    min-width: 1160px;
}

.section {
    padding: 120px 0;
}

.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;
}

/* blind : ์ ‘๊ทผ์„ฑ์„ ์ด์œ ๋กœ ํ•„์š”๋กœ ํ•œ๋‹ค. */
.blind {
    position: absolute;
    clip: rect(0 0 0 0);
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
}

/* cardType03 */
body {
    background-color: #2254c3;
}

.card__inner {
    display: flex;
}

.card__inner .card {
    padding: 26px;
    width: 33.3333%;
    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;
}

.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;

}

.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;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical;
    margin-bottom: 30px;
}

.card__footer {
    display: flex;
    justify-content: end;
}

.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-color: #000;
    display: block;
    border-radius: 50%;
    overflow: hidden;
    margin-left: 10px;
    margin-top: 4px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
}

โ€ปiR ํšจ๊ณผโ€ป

iR ํšจ๊ณผ(์ด๋ฏธ์ง€ ๋Œ€์ฒด ํšจ๊ณผ == alt)
์ด๋ฏธ์ง€ ๋Œ€์ฒด ํ…์ŠคํŠธ ์ œ๊ณต์„ ์œ„ํ•œ css ๊ธฐ๋ฒ•. ์›น ์ ‘๊ทผ์„ฑ์„ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

โ€ปBlindโ€ป

์›น ์ ‘๊ทผ์„ฑ์„ ๊ณ ๋ คํ•œ ์š”์†Œ ์ˆจ๊น€์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.
์Šคํฌ๋ฆฐ ๋ฆฌ๋”๋Š” width, height๊ฐ€ 0์ธ ์†์„ฑ๋“ค์€ ์ฝ์„ ์ˆ˜ ์—†๊ธฐ ๋Œ€๋ฌธ์— ์‚ฌ์ด์ฆˆ๋Š” ์ตœ์†Œ 1px ์ด์ƒ์œผ๋กœ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

โ€ป๋ง์ค„์ž„ ํšจ๊ณผโ€ป

- ๋ง์ค„์ž„ ํšจ๊ณผ๋Š” ํ•œ ์ค„์˜ ์˜์—ญ ์•ˆ์— ๋ชจ๋“  ๊ธ€์ž๋ฅผ ๋„ฃ๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
- ์˜์—ญ์„ ๋„˜์–ด๊ฐ€๊ฒŒ ๋˜๋ฉด ... ์œผ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
- ๋ง์ค„์ž„ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•˜๊ณ  ์‹ถ์€ ์˜์—ญ์— ์•„๋ž˜ ํƒœ๊ทธ๋ฅผ ๋„ฃ์Šต๋‹ˆ๋‹ค.

ํ•œ ์ค„ ํšจ๊ณผ

{
width:100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

๋‘ ์ค„ ํšจ๊ณผ

{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}

์„ธ ์ค„ ํšจ๊ณผ

{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}

728x90
๋ฐ˜์‘ํ˜•

'Site ์ œ์ž‘' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

02. ์ด๋ฏธ์ง€ ์œ ํ˜• - 3  (4) 2022.08.21
02. ์ด๋ฏธ์ง€ ์œ ํ˜• - 2  (3) 2022.08.18
02. ์ด๋ฏธ์ง€ ์œ ํ˜• - 1  (3) 2022.08.18
02. ์นด๋“œ ์œ ํ˜•-2  (7) 2022.08.10
01. ์นด๋“œ ์œ ํ˜•-1  (3) 2022.08.09

๋Œ“๊ธ€