์ฌ์ดํธ ๋ง๋ค๊ธฐ : ์ด๋ฏธ์ง ์ ํ 02
์ด๋ฒ ํฌ์คํ ์์๋ Figma์์ ๋ง๋ ์ด๋ฏธ์ง ์ ํ ์น์ ์ HTML๊ณผ CSS ์ฝ๋๋ก ์ฎ๊ธฐ๋ ์์ ์ ํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
Figma
๋จผ์ ๋ง๋ค๊ณ ์ ํ๋ ์น ์ฌ์ดํธ์ ๋ชจ์์ Figma๋ผ๋ ํ๋ก๊ทธ๋จ์ ์ด์ฉํ์ฌ ์๋์ ๊ฐ์ด ๋ง๋ค์ด์ฃผ๋๋ก ํ์.
์ด๋ฒ์ ๋ง๋ค ์น ์ฌ์ดํธ์ ์ ํ์ ์ด๋ฏธ์ง ์์ ์ ๋ชฉ๊ณผ ์์ธํ ๋ณด๊ธฐ ๋ฒํผ์ ์ฌ๋ ค๋๊ณ ๊ทธ๊ฑธ hover ํจ๊ณผ๋ก ์๋ก ๋ํ๋๊ฒ ํ๋ ์ ๋๋ฉ์ด์
์ ์ฃผ๋๋ก ํ๊ฒ ๋ค.
HTML ์์ค
์น ํ์ค ์ค์๋ฅผ ์ํด ์๋งจํฑ ํ๊ทธ๋ฅผ ์ ๊ทน ์ฌ์ฉํ๋๋ก ํ์. ์์ธํ ์ค๋ช ์ ์๋ ์์ ์ฝ๋์ ์ฃผ์์ฒ๋ฆฌ ๋ด์ฉ์ ์ฐธ์กฐํ ๊ฒ.
<body>
<section id="imageType02" class="image__wrap gmarket section">
<h1>๋ณ๋น ์ ๋นต๊ต์ค ๊ฐ์ฌ ์๊ฐ๐</h1>
<p>์ฌ๋ ์๋ ๋๋ฌผ์ด์ง๋ง ํ๋ฅญํ ์ค๋ ฅ์ ๊ฐ์ง ๋ณ๋น ์ ๋นต๊ต์ค์ ๊ฐ์ฌ๋ถ๋ค์ ์๊ฐํฉ๋๋ค!</p>
<div class="image__inner container">
<article class="image img1">
<figure class="image__box">
<img src="img/imageType02_bg01.jpg" alt="๋๋์ด">
</figure>
<div class="image__desc">
<h3>๋๋์ด</h3>
<a href="/" class="more" title="์์ธํ ๋ณด๊ธฐ">์์ธํ ๋ณด๊ธฐ</a>
</div>
</article>
<article class="image img2">
<figure class="image__box">
<img src="img/imageType02_bg02.jpg" alt="๋ฅ๋ฅ์ด">
</figure>
<div class="image__desc">
<h3>๋ฅ๋ฅ์ด</h3>
<a href="/" class="more" title="์์ธํ ๋ณด๊ธฐ">์์ธํ ๋ณด๊ธฐ</a>
</div>
</article>
<article class="image img3">
<figure class="image__box">
<img src="img/imageType02_bg03.jpg" alt="๋ถ๊ทน๊ณฐ">
</figure>
<div class="image__desc">
<h3>๋ถ๊ทน๊ณฐ</h3>
<a href="/" class="more" title="์์ธํ ๋ณด๊ธฐ">์์ธํ ๋ณด๊ธฐ</a>
</div>
</article>
</div>
</section>
</body>
CSS ์์ค
reset์์ margin๊ฐ๊ณผ padding๊ฐ์ 0์ผ๋ก ์ด๊ธฐํ ์ํค๋ ์์
๋ถํฐ ์์ํ๋ค.
๋ํ, ์ ๋๋ฉ์ด์
ํจ๊ณผ๋ฅผ ์ฃผ๊ธฐ ์ํด transition ์์ฑ๊ณผ :hover ์์ฑ์ ์ ๊ทน ํ์ฉํ๋ค.
์์ธํ ์ค๋ช
์ ์๋ ์์ ์ฝ๋์ ์ฃผ์์ฒ๋ฆฌ๋ ๋ด์ฉ์ ์ฐธ์กฐํ ๊ฒ.
<style>
/* fonts */
@import url('https://webfontworld.github.io/gmarket/GmarketSans.css');
.gmarket {
font-family: 'GmarketSans';
font-weight: 400;
}
/* 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 > h1 {
font-size: 50px;
line-height: 1;
text-align: center;
margin-bottom: 20px;
}
.section > p {
font-size: 22px;
font-weight: 300;
text-align: center;
margin-bottom: 70px;
color: #666;
}
/* imageType */
.image__inner {
display: flex;
justify-content: space-between;
}
.image {
width: 32%;
position: relative;
overflow: hidden;
}
.image__box {
height: 100%;
}
.image__box img {
transition: all 0.5s ease-in-out; /* 0.5์ด๋์ ๊ฑธ์ณ ๋ณํ ์ฃผ๋๋ก ์ ๋๋ฉ์ด์
์ค์ */
}
.image__desc {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
padding: 20px;
box-sizing: border-box; /* image__desc ๋ฐ์ค ์๋์น๊ฒ ํ๊ธฐ */
backdrop-filter: blur(10px);
transition: all 0.3s ease-in-out;
}
/* ์ด๋ฏธ์ง ์ค๋ช
์นธ ๋ฐฐ๊ฒฝ์, h3/more ๊ธ์จ์์ ์ค์ */
.img1 > .image__desc {
background: rgba(178, 82, 36, 0.5);
}
.img1 > .image__desc h3 {
color: #fff;
}
.img1 > .image__desc .more {
color: #fff;
}
.img2 > .image__desc {
background-color: rgba(187, 238, 239, 0.5);
}
.img2 > .image__desc h3 {
color: #006462;
}
.img2 > .image__desc .more {
color: #006462;
}
.img3 > .image__desc {
background-color: rgba(161, 166, 172, 0.5);
}
.img3 > .image__desc h3 {
color: #183169;
}
.img3 > .image__desc .more {
color: #183169;
}
/* ์๋ก ์ฌ๋ผ์ค๋ ์ ๋๋ฉ์ด์
์ฃผ๊ธฐ ์ํด hover ํจ๊ณผ ์ฃผ๊ธฐ */
.img1 .image__desc {
bottom: -100px;
}
.img1:hover .image__desc {
bottom: 0;
}
.img2 .image__desc {
bottom: -100px;
}
.img2:hover .image__desc {
bottom: 0;
}
.img3 .image__desc {
bottom: -100px;
}
.img3:hover .image__desc {
bottom: 0;
}
.image:hover .image__box img {
transform: scale(1.05); /* ๋ง์ฐ์ค ์ปค์ ์ฌ๋ฆฌ๋ฉด 1.05์ ๋ ์ด๋ฏธ์ง ํค์์ค */
}
/* ์ด๋ฏธ์ง ์ค๋ช
์นธ ๊ธ์จ ํฌ๊ธฐ์ margin๊ฐ ๋ฑ๋ฑ... */
.image__desc h3 {
font-size: 24px;
margin-bottom: 5px;
}
.image__desc .more {
font-size: 16px;
font-weight: 300;
}
.image__desc .more:hover {
text-decoration: underline;
}
</style>
๋๊ธ