์ค๋์ ์ด๋ฐ UI๋ฅผ css๋ก ๊ตฌํํด๋ณผ ๊ฒ์. ์ด์ ๋ ๋๊ฐ ์ด๋ป๊ฒ ํ๋๊ณ ๋ฌผ์ด๋ด์.
<div class="wrap">
<div class="img-box">
<img src="์ด๋ฏธ์งURL" alt="์ด๋ฏธ์ง"/>
<p class="color-red">Christmas</p>
</div>
<p class="color-green">Christmas</p>
</div>
.img-box
๋ด์ ์ด๋ฏธ์ง, ๋นจ๊ฐ์ ํ
์คํธ ๋ถ๋ถ์ ๊ฐ์ด ๋ฃ์ด์ค
์ด๋ก์ ํ
์คํธ ๋ถ๋ถ์ .img-box
๋ฐ์๋ค ๋ฐฐ์น
/*์ต์์ ๊ป๋ฐ๊ธฐ ์์ฑ*/
.wrap {
margin: 30px;
position: relative;
width: 155px;
height: 155px;
}
/*์ด๋ฏธ์ง ๋ฐ์ค ํจ๊ณผ ์ฃผ๊ธฐ*/
.img-box {
z-index: 1;
position: relative;
width: 100%;
height: 100%;
border-radius: 10px;
overflow: hidden;
box-shadow: 0px 4px 4px 0px rgba(52, 70, 83, 0.25);
}
.img-box img{
width: 100%;
height: 100%;
}
/*ํ
์คํธ ์คํ์ผ ๊ฐ*/
p{
margin: 0;
position: absolute;
text-align: center;
left: 50%;
transform: translate(-50%, -50%);
}
.color-red{
top: 0;
color: #FF2424;
}
.color-green {
top:0;
color: #167230;
}
.img-box
์ ์ด๋ก์ ํ
์คํธ๋ฅผ ๋ฐ ์ฏค ๊ฑธ์ณ์ฃผ์ด์ผ ํ๋๊น .wrap
์๋ position: relative;
๊ฐ ๋ค์ด๊ฐ์ผํจ
.img-box
๊ฐ ์ด๋ก์ ํ
์คํธ๋ณด๋ค ์์ ์์ผํ๋๊น z-index
์ถ๊ฐ
ํ
์คํธ ์ค์ ์ ๋ ฌ text-align
๋ง๊ณ position
์ผ๋ก ์กฐ์
์์ฑ
(์ด๋ฏธ์ง svg๋ก ๋ณต๋ถ ํด์ค๋๋ผ ์ฝ๋ ๊ธด ๊ฑฐ ๋ฌด์ํด์ฃผ์ธ์ฉ.)