๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Site

[์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ] ํ…์ŠคํŠธ ์œ ํ˜• 03

by ์ฝ”๋”ฉ๊ณต์ฑ… 2022. 9. 1.
๋ฐ˜์‘ํ˜•

์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ : ํ…์ŠคํŠธ ์œ ํ˜• STUDY 03

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” Figma์—์„œ ๋งŒ๋“  ํ…์ŠคํŠธ ์œ ํ˜• ์„น์…˜์„ HTML๊ณผ CSS ์ฝ”๋“œ๋กœ ์˜ฎ๊ธฐ๋Š” ์ž‘์—…์„ ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
์•„์ด์ฝ˜ ์ถœ๋ ฅ์€ ์•„์ด์ฝ˜์ด ๋“ค์–ด๊ฐˆ ์›์„ ๋จผ์ € ์ฝ”๋”ฉ์œผ๋กœ ๋งŒ๋“ค์–ด ๋‚ธ ํ›„, ์•„์ด์ฝ˜์„ ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ ๊ธฐ๋ฒ•์œผ๋กœ ์› ์•ˆ์— ๋„ฃ๋Š” ์‹์œผ๋กœ ์ฝ”๋”ฉ์„ ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค.


Figma

๋จผ์ € ๋งŒ๋“ค๊ณ ์ž ํ•˜๋Š” ์›น ์‚ฌ์ดํŠธ์˜ ๋ชจ์–‘์„ Figma๋ผ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ด์šฉํ•˜์—ฌ ์•„๋ž˜์™€ ๊ฐ™์ด ๋งŒ๋“ค์–ด์ฃผ๋„๋ก ํ•˜์ž. ๊ทธ์™€ ๋™์‹œ์— ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ์šฉ ์•„์ด์ฝ˜ SVG๋ฅผ ์ถœ๋ ฅํ•  ํŽ˜์ด์ง€๋„ ๋”ฐ๋กœ ๋งŒ๋“ค๋„๋ก ํ•œ๋‹ค. ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์€ ์ง€๋‚œ ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ ํฌ์ŠคํŒ…์„ ์ฐธ์กฐํ•  ๊ฒƒ.

HTML ์†Œ์Šค

์›น ํ‘œ์ค€ ์ค€์ˆ˜๋ฅผ ์œ„ํ•ด ์‹œ๋งจํ‹ฑ ํƒœ๊ทธ๋ฅผ ์ ๊ทน ์‚ฌ์šฉํ•˜๋„๋ก ํ•˜์ž. img ํƒœ๊ทธ์˜ alt์™€ ๊ฐ™์€ ํšจ๊ณผ๋ฅผ ์ฃผ๊ธฐ ์œ„ํ•ด ์•„์ด์ฝ˜์ด ๋“ค์–ด๊ฐˆ span ํƒœ๊ทธ์˜ ํด๋ž˜์Šค ๊ฐ’์„ "ir"๋กœ ์„ค์ •ํ•˜์ž. ์ž์„ธํ•œ ์„ค๋ช…์€ ์•„๋ž˜ ์˜ˆ์‹œ ์ฝ”๋“œ์˜ ์ฃผ์„์ฒ˜๋ฆฌ ๋‚ด์šฉ์„ ์ฐธ์กฐํ•  ๊ฒƒ.

<body>
    <section id="cardType03" class="card__wrap gmarket section">
        <h2>๊ฐ€์„์— ๋Œ€ํ•ด ์ด์•ผ๊ธฐํ•ด๋ณด์ž๐ŸŒพ</h2>
        <p>๊ณง ๋‹ค๊ฐ€์˜ฌ ๊ฐ€์„์— ๋Œ€ํ•˜์—ฌ ์ด๋Ÿฐ์ €๋Ÿฐ ์ด์•ผ๊ธฐ๋“ค์„ ํ•ด๋ณด์•„์š”!</p>
        <div class="card__inner container">
            <article class="card">
                <div class="card__body">
                    <p class="desc">
                        ๋น„์—ผ์ธ์ธ ๋‚˜์—๊ฒŒ ๊ฐ€์žฅ ๊ณ ํ†ต์Šค๋Ÿฌ์šด ๊ณ„์ ˆ์ด ๋Œ์•„์™”๋‹ค. ๋งŽ์€ ์ด๋“ค์ด ์ข‹์•„ํ•˜๋Š” ๋ด„๊ณผ ๊ฐ€์„์„ ์‹ซ์–ดํ•˜๋Š” ์ด์œ ๋„ ์ด ๋นŒ์–ด๋จน์„ ๋น„์—ผ ๋•Œ๋ฌธ์ด์ง€โ€ฆ ์˜ค๋Š˜๋„ ์ฝง๋ฌผ์ด ์‰ด์ƒˆ์—†์ด ํ๋ฅด๋Š”๊ตฌ๋‚˜๐Ÿคง ๋นจ๋ฆฌ ํ™˜์ ˆ๊ธฐ๊ฐ€ ๋๋‚˜๊ณ  ๊ฒจ์šธ์ด ์ฐพ์•„์™”์œผ๋ฉด ์ข‹๊ฒ ๋‹ค. ๋‚œ ๊ฒจ์šธ์ด ์ œ์ผ ์ข‹์•„๐Ÿฅถ
                    </p>
                    <hr>
                    <div class="profile">
                        <span id="card__icon" class="icon__logo1" aria-hidden="๊น€๋ช…ํฌ">
                            <a href="#" class="link1"><span class="ir">๊น€๋ช…ํฌ</span></a>
                        </span>
                        <div class="user__name">
                            <h2>๊น€๋ช…ํฌ</h2>
                            <p>@mh123</p>
                            <span id="star">
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_empty"><span class="ir">๋ณ„ ๋น„์›Œ์ง</span></a>
                                <a class="star_empty"><span class="ir">๋ณ„ ๋น„์›Œ์ง</span></a>
                                <a class="star_empty"><span class="ir">๋ณ„ ๋น„์›Œ์ง</span></a>
                                <a class="star_empty"><span class="ir">๋ณ„ ๋น„์›Œ์ง</span></a>
                            </span>
                        </div>
                    </div>
                    <hr>
                    <button class="more">
                        <a href="#">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
                    </button>
                </div>
            </article>
            <article class="card">
                <div class="card__body">
                    <p class="desc">
                        ๋‚ด๊ฐ€ ์‚ฌ๊ณ„์ ˆ ์ค‘ ๊ฐ€์žฅ ์ข‹์•„ํ•˜๋Š” ๊ณ„์ ˆ์ด ์˜จ๋‹ค. ๋‚ฎ์ด ๊ธด ๊ฒƒ์„ ๋ณ„๋กœ ์ข‹์•„ํ•˜์ง€ ์•Š๋Š” ๋‚˜์—๊ฒŒ ์ผ์กฐ๋Ÿ‰์ด ๋‚ฎ์•„์ง€๊ณ  ๋‚ฎ์˜ ๊ธธ์ด๊ฐ€ ์งง์•„์ ธ๊ฐ€๋Š” ์ด ์‹œ๊ธฐ๋Š” ์•ˆ์ •๊ฐ์„ ์•ˆ๊ฒจ์ค€๋‹ค. ๋ฌด์—‡๋ณด๋‹ค ๊ทธ ์•…๋ชฝ๊ฐ™์€ ๋”์œ„๊ฐ€ ๋๋‚ฌ๋‹ค๋Š” ๊ฒƒ์— ๋Œ€ํ•œ ์•ˆ๋„๊ฐ๋„ ํฌ๋‹ค. ์•„๋ฌดํŠผ ๊ณง ์˜ฌ ๊ฐ€์„์„ ํ™˜์˜ํ•œ๋‹คโ˜บ
                    </p>
                    <hr>
                    <div class="profile">
                        <span id="card__icon" class="icon__logo2" aria-hidden="์ตœ๊ฐ€์„">
                            <a href="#" class="link2"><span class="ir">์ตœ๊ฐ€์„</span></a>
                        </span>
                        <div class="user__name">
                            <h2>์ตœ๊ฐ€์„</h2>
                            <p>@autumn_lover</p>
                            <span id="star">
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                            </span>
                        </div>
                    </div>
                    <hr>
                    <button class="more">
                        <a href="#">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
                    </button>
                </div>
            </article>
            <article class="card">
                <div class="card__body">
                    <p class="desc">
                        ๊ฐ€์„์€ ๋…์„œ์˜ ๊ณ„์ ˆ์ด์ง€์š”. ํ•˜์ง€๋งŒ ์š”์ฆ˜ ๋ฐ”๋น ์„œ ์ฑ… ์ฝ์„ ์‹œ๊ฐ„์ด ์—†๋„ค์š”. ์จŒ๋“  ์ €๋Š” ๊ฐ€์„์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์•ž์— ๋ถ„์ฒ˜๋Ÿผ ์ €๋„ ๋น„์—ผ์ธ์ด๋ผ์„œ ์™„์ „ํžˆ ์‚ฌ๋ž‘ํ•  ์ˆœ ์—†๋Š” ์• ์ฆ์˜ ๊ณ„์ ˆ์ด์ง€๋งŒ์š”โ€ฆ๐Ÿ˜‚ ๊ฒจ์šธ ํ˜นํ•œ๊ณผ ์—ฌ๋ฆ„ ํ˜น์„œ๋ฅผ ๋ชป๊ฒฌ๋”œ ์ •๋„๋กœ ์‹ซ์–ดํ•ด์„œ์ผ๊นŒ์š”? ใ…Žใ…Ž
                    </p>
                    <hr>
                    <div class="profile">
                        <span id="card__icon" class="icon__logo3" aria-hidden="์ด๋•ก๋•ก">
                            <a href="#" class="link3"><span class="ir">์ด๋•ก๋•ก</span></a>
                        </span>
                        <div class="user__name">
                            <h2>์ด๋•ก๋•ก</h2>
                            <p>@lee_tt</p>
                            <span id="star">
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_fill"><span class="ir">๋ณ„ ์ฑ„์›Œ์ง</span></a>
                                <a class="star_empty"><span class="ir">๋ณ„ ๋น„์›Œ์ง</span></a>
                            </span>
                        </div>
                    </div>
                    <hr>
                    <button class="more">
                        <a href="#">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
                    </button>
                </div>
            </article>
        </div>
    </section>
</body>

CSS ์†Œ์Šค

reset์—์„œ margin๊ฐ’๊ณผ padding๊ฐ’์„ 0์œผ๋กœ ์ดˆ๊ธฐํ™” ์‹œํ‚ค๋Š” ์ž‘์—…๋ถ€ํ„ฐ ์‹œ์ž‘ํ•œ๋‹ค. ์•„์ด์ฝ˜ ์ถœ๋ ฅ์€ ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ์™€ IR ํšจ๊ณผ๋ฅผ ์ ๊ทน ํ™œ์šฉํ•˜๋„๋ก ํ•œ๋‹ค. ์ž์„ธํ•œ ์„ค๋ช…์€ ์•„๋ž˜ ์˜ˆ์‹œ ์ฝ”๋“œ์˜ ์ฃผ์„์ฒ˜๋ฆฌ๋œ ๋‚ด์šฉ์„ ์ฐธ์กฐํ•  ๊ฒƒ.

<style>
    /* fonts */
    @import url('https://webfontworld.github.io/gmarket/GmarketSans.css');

    .gmarket {
        font-family: 'GmarketSans';
        font-weight: 400;
    }

    /* reset */
    * {
        margin: 0;
        padding: 0;
    }
    body {
        background-color: #FDF6F6;
    }
    h1, h2, h3, h4, h5, h6 {
        font-weight: normal;
    }
    a {
        text-decoration: none;
        color: #fff;
    }
    img {
        width: 100%;    /* ์ด๋ฏธ์ง€ ํŠ€์–ด๋‚˜์˜จ ๊ฑฐ ์ง‘์–ด๋„ฃ๊ธฐ */
    }
    hr {
        margin: 30px 0;
    }
    button {
        border: none;
        font-family: 'GmarketSans';
        cursor: pointer;
    }

    /* common */
    .container {
        width: 1160px;
        padding: 0 20px;
        margin: 20px auto;
        min-width: 1160px;  /* ๋ฐ˜์‘ํ˜• ํ•  ๋•Œ ์—†์• ์ค„ ๊ฒƒ */
    }
    .section {
        padding: 120px 0;
    }
    .section > h2 {
        font-size: 50px;
        line-height: 1;
        text-align: center;
        margin-bottom: 30px;
    }
    .section > p {
        font-size: 24px;
        text-align: center;
        margin-bottom: 70px;
        font-weight: 500;
        color: #666;
    }

    /* cardType */
    .card__inner {
        display: flex;
        justify-content: space-between;     /* ๊ฐ„๊ฒฉ ๋–จ์–ด๋œจ๋ฆฌ๊ธฐ */
    }
    .card {
        width: 33%;
        background: #fff;
        border-radius: 10px;
        margin-right: 20px;
    }
    #card__icon {
        width: 60px;
        height: 60px;
        display: block;
        border-radius: 100%;
        margin-right: 10px;
    }
    /* ์•„์ด์ฝ˜ ํ•˜๋‚˜ํ•˜๋‚˜์— ์ƒ‰๊น” ๋„ฃ์–ด์ฃผ๊ธฐ */
    .icon__logo1 {
        background-color: #fceceb;
    }
    .icon__logo2 {
        background-color: #ecfceb;
    }
    .icon__logo3 {
        background-color: #fcebfb;
    }

    .card__body {
        padding: 30px;
    }
    .card__body .title {
        font-size: 24px;
        margin-bottom: 10px;
        font-weight: 500;
        /* ํ•œ ์ค„ ํšจ๊ณผ */
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding-right: 30px;    /* ์ œ๋ชฉ ๊ธธ์–ด์ ธ๋„ ํ•œ ์ค„ ์œ ์ง€ */
    }
    .card__body .desc {
        font-size: 20px;
        font-weight: 500;
        line-height: 1.4;
        /* 7์ค„ํšจ๊ณผ : ๊ธ€์ด ๋„˜์ณ๋„ 7์ค„์„ ๋„˜์ง€ ์•Š๋„๋ก ํ•ด์คŒ */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 7;  /* 7์ค„๊นŒ์ง€ ์ œํ•œ */
        -webkit-box-orient: vertical;
    }
    .card__body .more {
        margin: 0 82px;
        font-size: 18px;
        font-weight: 500;
        color: #fff;
        border-radius: 17px;
        background-color: #e1a39f;
        padding: 8px 25px;
    }

    .profile {
        display: flex;
    }
    .user__name > h2 {
        font-size: 28px;
        font-weight: 500;
        position: relative;
    }
    .user__name > p {
        font-size: 18px;
        font-weight: 300;
        position: absolute;
        top: 592px;
        padding-left: 90px;
        font-size: 16px;
        font-weight: 300;
        color: #666;
    }

    /* ir ํšจ๊ณผ (์ด๋ฏธ์ง€ ๋Œ€์ฒด ํšจ๊ณผ == alt) */
    /* ํ™”๋ฉด์ƒ์—์„œ๋Š” ์•ˆ๋‚˜์˜ค๊ฒŒ ํ•จ๊ณผ ๋™์‹œ์— ์Šคํฌ๋ฆฐ๋ฆฌ๋”๊ธฐ์—๋Š” ์ฝํžˆ๊ฒŒ ํ•˜๋Š” ์ž‘์—… */
    .ir {
        display: block;
        overflow: hidden;
        font-size: 0;
        line-height: 0;
        text-indent: -9999px;
    }

    /* ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ */
    /* ์•„์ด์ฝ˜ 5๊ฐœ๋ฅผ ์ด์–ด ๋งŒ๋“  ํ”„๋ ˆ์ž„์„ SVG๋กœ ์ถ”์ถœํ•˜์—ฌ ๊ทธ ์ขŒํ‘œ๊ฐ’์„ ์•„๋ž˜์™€ ๊ฐ™์ด
        ์˜ฎ๊ฒจ๊ฐ€๋ฉฐ ์•„์ด์ฝ˜ ํ•˜๋‚˜์”ฉ ๋ณด์ด๋„๋ก ํ•˜๋Š” ๊ธฐ๋ฒ• */
    #card__icon a {
        width: 30px;
        height: 30px;
        display: block;
        background: url(img/textType_icon03.svg);
        padding: 15px;
    }
    /* nth-child๊ฐ€ ๋จนํžˆ์ง€ ์•Š์œผ๋‹ˆ a์˜ ํด๋ž˜์Šค๊ฐ’์„ link1, link2... ์ด๋Ÿฐ์‹์œผ๋กœ ๋ฐ”๊พธ์ž */
    #card__icon a.link1 {
        background-position: 0px 0;
    }
    #card__icon a.link2 {
        background-position: -80px 0;
    }
    #card__icon a.link3 {
        background-position: -160px 0;
    }
    
    /* ๋ณ„์  */
    #star a {
        width: 14px;
        height: 14px;
        display: inline-block;
    }
    #star > .star_fill {
        background: url(img/star.svg);
    }
    #star > .star_empty {
        background: url(img/star_empty.svg);
    }
</style>

์ตœ์ข… ๊ฒฐ๊ณผ

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€


Reference Book

JavaScript
HTML
CSS
๊ด‘๊ณ  ์ค€๋น„์ค‘์ž…๋‹ˆ๋‹ค.