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

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

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

 

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

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

HTML ์†Œ์Šค

๋จผ์ €, container-fluid๋ผ๋Š” ์ปค๋‹ค๋ž€ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ž‘์—…ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ์ปจํ…Œ์ด๋„ˆ ์•ˆ์—๋Š” ๋‹ค์„ฏ ๊ฐœ์˜ article ํƒœ๊ทธ๋ฅผ ๋„ฃ์–ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ๊ฐ์˜ article ์•ˆ์—๋Š” ์ด๋ฏธ์ง€์™€ ์„ค๋ช…, sns์— ํ•ด๋‹นํ•˜๋Š” div ๋ฐ•์Šค๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ์ฒซ ๋ฒˆ์งธ article์—๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋ฐฑ๊ทธ๋ผ์šด๋“œ ๋ฐฉ์‹์œผ๋กœ ์‚ฝ์ž…ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๋“œ๋กœ ๋ ˆ์ด์•„์›ƒ์„ ์ž‘์—…ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์—, ์ด๋ฏธ์ง€ ๊นจ์ง์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด์„œ์ž…๋‹ˆ๋‹ค.

<section id="imageType03" class="card__wrap gowun section">
    <h2>์„ธ๊ณ„ 7๋Œ€ ๋ถˆ๊ฐ€์‚ฌ๋ฆฌ</h2>
    <p>๊ฒฝ์ด๋กœ์šด ์ง€๊ตฌ์ƒ์˜ 7๋Œ€ ๋ถˆ๊ฐ€์‚ฌ๋ฆฌ๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.<br>
        ์•„๋ž˜์˜ ์ด๋ฏธ์ง€๋“ค์„ ํด๋ฆญํ•ด ๋ณด์„ธ์š”.</p>
    <div class="image__inner container-fluid">
        <article class="image">
            <!-- <figure class="image__box">
                <img src="img/img03_bg01.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure> -->
            <div class="image__desc">
                <h3>Wow! Starfish</h3>
                <p>unbelievable</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">ํŽ˜์ด์Šค๋ถ</span></a>
                <a href="#" class="link"><span class="ir">ํŠธ์œ„ํ„ฐ</span></a>
                <a href="#" class="link"><span class="ir">์ธ์Šคํƒ€๊ทธ๋žจ</span></a>
                <a href="#" class="link"><span class="ir">์œ ํŠœ๋ธŒ</span></a>
                <a href="#" class="link"><span class="ir">๋งํฌ</span></a>
            </div>
        </article>
        <article class="image">
            <figure class="image__box">
                <img src="img/img03_bg02.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure>
            <div class="image__desc">
                <h3>Wow! Starfish</h3>
                <p>unbelievable</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">ํŽ˜์ด์Šค๋ถ</span></a>
                <a href="#" class="link"><span class="ir">ํŠธ์œ„ํ„ฐ</span></a>
                <a href="#" class="link"><span class="ir">์ธ์Šคํƒ€๊ทธ๋žจ</span></a>
                <a href="#" class="link"><span class="ir">์œ ํŠœ๋ธŒ</span></a>
                <a href="#" class="link"><span class="ir">๋งํฌ</span></a>
            </div>
        </article>
        <article class="image">
            <figure class="image__box">
                <img src="img/img03_bg03.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure>
            <div class="image__desc">
                <h3>Wow! Starfish</h3>
                <p>unbelievable</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">ํŽ˜์ด์Šค๋ถ</span></a>
                <a href="#" class="link"><span class="ir">ํŠธ์œ„ํ„ฐ</span></a>
                <a href="#" class="link"><span class="ir">์ธ์Šคํƒ€๊ทธ๋žจ</span></a>
                <a href="#" class="link"><span class="ir">์œ ํŠœ๋ธŒ</span></a>
                <a href="#" class="link"><span class="ir">๋งํฌ</span></a>
            </div>
        </article>
        <article class="image">
            <figure class="image__box">
                <img src="img/img03_bg04.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure>
            <div class="image__desc">
                <h3>Wow! Starfish</h3>
                <p>unbelievable</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">ํŽ˜์ด์Šค๋ถ</span></a>
                <a href="#" class="link"><span class="ir">ํŠธ์œ„ํ„ฐ</span></a>
                <a href="#" class="link"><span class="ir">์ธ์Šคํƒ€๊ทธ๋žจ</span></a>
                <a href="#" class="link"><span class="ir">์œ ํŠœ๋ธŒ</span></a>
                <a href="#" class="link"><span class="ir">๋งํฌ</span></a>
            </div>
        </article>
        <article class="image">
            <figure class="image__box">
                <img src="img/img03_bg05.jpg" alt="๋ถˆ๊ฐ€์‚ฌ๋ฆฌ">
            </figure>
            <div class="image__desc">
                <h3>Wow! Starfish</h3>
                <p>unbelievable</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">ํŽ˜์ด์Šค๋ถ</span></a>
                <a href="#" class="link"><span class="ir">ํŠธ์œ„ํ„ฐ</span></a>
                <a href="#" class="link"><span class="ir">์ธ์Šคํƒ€๊ทธ๋žจ</span></a>
                <a href="#" class="link"><span class="ir">์œ ํŠœ๋ธŒ</span></a>
                <a href="#" class="link"><span class="ir">๋งํฌ</span></a>
            </div>
        </article>
    </div>
</section>

CSS ์†Œ์Šค

ํฐํŠธ๋Š” ๊ณ ์šด ๋ฐ”ํƒ•์„ ์‚ฌ์šฉํ•˜์˜€๊ณ , ์ด๋ฒˆ์—๋Š” flex๊ฐ€ ์•„๋‹Œ grid๋ฅผ ํ†ตํ•ด ๋ ˆ์ด์•„์›ƒ์„ ์ž‘์—…ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ๊ฐ์˜ ์•„์ด์ฝ˜์—๋Š” ์›น ํ‘œ์ค€์„ฑ์„ ์ค€์ˆ˜ํ•  ์ˆ˜ ์žˆ๋„๋ก irํšจ๊ณผ๋ฅผ ๋„ฃ์–ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ์•„์ด์ฝ˜์„ ์‚ฝ์ž…ํ•  ๋•Œ๋Š” ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ ๊ธฐ๋ฒ•์„ ์‚ฌ์šฉํ•˜์˜€๋Š”๋ฐ์š”, ๊ฒŒ์‹œ๊ธ€ ์ƒ๋‹จ์˜ ํ”ผ๊ทธ๋งˆ์—์„œ ์•„์ด์ฝ˜๋“ค์˜ ์ง‘ํ•ฉ ํ”„๋ ˆ์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ํ”„๋ ˆ์ž„์„ svg ํŒŒ์ผ๋กœ ์ €์žฅํ•œ ๋’ค, background-position์œผ๋กœ ์ด๋ฏธ์ง€์˜ ์œ„์น˜๋ฅผ ์กฐ์ •์‹œ์ผœ ์†์‰ฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์‚ฝ์ž…ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

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

.gowun {
    font-family: 'GowunBatang';
    font-weight: 400;
}

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

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

img {
    width: 100%;
    vertical-align: top;
}

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

.ir {
    display: block;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
}

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

.container-fluid {
    width: 100%;
    padding: 0 100px;
    box-sizing: border-box;
}

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

/* imageType */
.image__inner {
    display: grid;
    grid-template-areas: 
        "box1 box1 box2 box3"
        "box1 box1 box4 box5";
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-auto-rows: 1fr 1fr;
    grid-gap: 20px;
}

.image {
    position: relative;
    overflow: hidden;
}

.image__inner .image:nth-child(1) {
    grid-area: box1;
    background: url(img/img03_bg01.jpg);
    background-size: cover;
}

.image__inner .image:nth-child(2) {
    grid-area: box2;
}

.image__inner .image:nth-child(3) {
    grid-area: box3;
}

.image__inner .image:nth-child(4) {
    grid-area: box4;
}

.image__inner .image:nth-child(5) {
    grid-area: box5;
}

.image__desc {
    position: absolute;
    left: 0;
    bottom: -100%;
    width: 100%;
    background-color: rgba(255,255,255,0.3);
    backdrop-filter: blur(6px);
    padding: 16px;
    box-sizing: border-box;
    transition: all 0.5s ease;
}

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

.image:hover .image__sns {
    right: 10px;
    transition: all 0.4s ease;
}

.image__desc h3 {
    font-size: 20px;
}

.image__desc p {
    font-size: 16px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image__sns {
    position: absolute;
    right: -100px;
    top: 10px;
}

.image__sns a {
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: block;
    margin-bottom: 5px;
    background: url(img/icon.svg) no-repeat;
}

/* ์ด๋ฏธ์ง€ ์Šคํ”„๋ผ์ดํŠธ ๊ธฐ๋ฒ• */
.image__sns a:nth-child(2){
    background-position: -50px 0;
}

.image__sns a:nth-child(3){
    background-position: -100px 0;
}

.image__sns a:nth-child(4){
    background-position: -150px 0;
}

.image__sns a:nth-child(5){
    background-position: -200px 0;
}

๊ฒฐ๊ณผ

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

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