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

์›น์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ : ์ด๋ฏธ์ง€ ์œ ํ˜• ๋ ˆ์ด์•„์›ƒ02

by ์ฝ”ํŒŒ์นด 2022. 8. 17.
728x90

๋ ˆ์ด์•„์›ƒ : ์ด๋ฏธ์ง€ ์œ ํ˜•02

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ด๋ฏธ์ง€ ์œ ํ˜•์˜ ๋ ˆ์ด์•„์›ƒ์„ ์ž‘์—…ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ์ด๋ฏธ์ง€๊ฐ€ ์ด ์„ธ ๊ฐœ์ด๋ฉฐ, ์ด๋ฏธ์ง€ ์œ„์— ๋งˆ์šฐ์Šค๋ฅผ hoverํ•˜๋ฉด '์ž์„ธํžˆ ๋ณด๊ธฐ' ๋ฒ„ํŠผ์ด ๋‚˜ํƒ€๋‚˜๋Š” CSS ์š”์†Œ๋„ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

HTML ์†Œ์Šค

๋จผ์ €, ์„ธ ๊ฐœ์˜ article ํƒœ๊ทธ๋ฅผ ๋งŒ๋“ค์–ด ๊ฐ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ์ฒจ๋ถ€ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. article ํƒœ๊ทธ ์•ˆ์—์„œ๋„ image ๋ถ€๋ถ„๊ณผ desc ๋ถ€๋ถ„์„ ๋‚˜๋ˆ„์–ด ์ž‘์—…ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

<section id="imageType02" class="card__wrap gmark section">
    <h2>๋ฐ”๋‹ค์— ์‚ฌ๋Š” ์ƒ๋ฌผ๋“ค</h2>
    <p>๋ฐ”๋‹ค์—๋Š” ์–ด๋–ค ์ƒ๋ฌผ๋“ค์ด ์‚ด๊ณ  ์žˆ์„๊นŒ์š”?</p>
    <div class="image__inner container">
        <article class="image img1">
            <figure class="image__box">
                <img src="img/img02_bg01.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure>
            <div class="image__desc">
                <h3>TTUNG-E</h3>
                <a href="/" class="more" title="์ž์„ธํžˆ ๋ณด๊ธฐ">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
            </div>
        </article>
        <article class="image img2">
            <figure class="image__box">
                <img src="img/img02_bg02.jpg" alt="๋ฌธ์–ด">
            </figure>
            <div class="image__desc">
                <h3 class="white">JingJing-E</h3>
                <a href="/" class="more white" title="์ž์„ธํžˆ ๋ณด๊ธฐ">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
            </div>
        </article>
        <article class="image img3">
            <figure class="image__box">
                <img src="img/img02_bg03.jpg" alt="๊ฒŒ">
            </figure>
            <div class="image__desc">
                <h3>Jibgeo-Sajang</h3>
                <a href="/" class="more" title="์ž์„ธํžˆ ๋ณด๊ธฐ">์ž์„ธํžˆ ๋ณด๊ธฐ</a>
            </div>
        </article>
    </div>
</section>

CSS ์†Œ์Šค

ํฐํŠธ๋Š” ์ง€๋งˆ์ผ“ ์‚ฐ์Šค๋ฅผ ์‚ฌ์šฉํ•˜์˜€๊ณ , display: flex๋ฅผ ์ด์šฉํ•˜์—ฌ ์„ธ ๊ฐœ์˜ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€๋กœ๋กœ ๋ฐฐ์น˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค. overflow-hidden์„ ์ด์šฉํ•˜์—ฌ desc ๋ฐ•์Šค๊ฐ€ ๋ณด์ด์ง€ ์•Š๊ฒŒ ๋งŒ๋“ค๊ณ , image์— ๋งˆ์šฐ์Šค๊ฐ€ hover๋˜์—ˆ์„ ๋•Œ image๊ฐ€ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋ฅผ ๋ณด์ด๋ฉฐ ํ™•๋Œ€๋˜๊ณ , desc ๋ฐ•์Šค๊ฐ€ ์•„๋ž˜์—์„œ ์œ„๋กœ ๋‚˜ํƒ€๋‚˜๊ฒŒ๋” ์ž‘์—…ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

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

.gmark {
    font-family: 'GmarketSans';
    font-weight: 500;
}

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

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

img {
    width: 100%;
}

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

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

.section {
    padding: 120px 0;
}

.section>h2 {
    font-size: 50px;
    line-height: 1;
    text-align: center;
    margin-bottom: 10px;
}

.section>p {
    font-size: 22px;
    font-weight: 300;
    color: #666;
    text-align: center;
    margin-bottom: 70px;
}

/* imageType */
.image__inner {
    display: flex;
    justify-content: space-between;
}

.image {
    width: 32%;
    position: relative;
    overflow: hidden;
}

.image__box img {
    vertical-align: top;
    height: 100%;
}

.image__desc {
    position: absolute;
    left: 0;
    bottom: -100px;
    transition: all 0.3s ease-in-out;
    width: 100%;
    text-align: center;
    height: 100px;
    backdrop-filter: blur(4px);
    padding: 25px 20px;
    box-sizing: border-box;
}

.img1 .image__desc {
    background: rgba(190, 163, 112, 0.1);
}

.img2 .image__desc {
    background: rgba(95, 35, 32, 0.1);
}

.img3 .image__desc {
    background: rgba(142, 141, 141, 0.1);
}

.img1 .image__desc h3 {
    color: white;
}

.img2 .image__desc h3 {
    color: white;
}

.img1 .image__desc .more {
    color: white;
}

.img2 .image__desc .more {
    color: white;
}

.image:hover .image__desc {
    bottom: 0px;    
}

.image:hover .image__box img {
    transform: scale(1.03);
    transition: all 0.6s ease-in-out;
}

.image__desc h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.image__desc .more {
    font-size: 16px;
    font-weight: 200;
}

.image__desc .more:hover {
text-decoration: underline;
}

๊ฒฐ๊ณผ

728x90

๋Œ“๊ธ€

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๐Ÿฆ™

CSS
๊ด‘๊ณ  ์ค€๋น„์ค‘