๋ธ๋ก๊ทธ ์นดํ ๊ณ ๋ฆฌ ํ์ด์ง ๋์์ธ ์์ 4๊ฐ์ง์ ๋ฐ์ํ HTML/CSS ์ฝ๋ ์ ์ฒด ํตํฉ
๋ธ๋ก๊ทธ ์นดํ ๊ณ ๋ฆฌ ํ์ด์ง์ ์ฌ๋ฏธ์ฑ๊ณผ ์ฌ์ฉ์ ๊ฒฝํ(UX)์ ๋์ด๋ 4๊ฐ์ง ๋ฐ์ํ ๋์์ธ ์คํ์ผ์ ํ๋์ ์์ฑ๋ HTML ์ฝ๋๋ก ์ ๊ณตํฉ๋๋ค. ์ธ๋ค์ผ, ํ ์คํธ ๋ฐฐ์น, ๋ฐ์ํ ๋ ์ด์์์ด ํตํฉ๋ ์ด ์ฝ๋ ํ ํ๋ฆฟ์ ๋ธ๋ก๊ทธ ์ด์์๊ฐ ์ฝํ ์ธ ํด๋ฆญ๋ฅ ๊ณผ ์ฒด๋ฅ ์๊ฐ์ ๋์ด๋ ๋ฐ ์ต์ ํ๋์ด ์์ต๋๋ค.
์นดํ ๊ณ ๋ฆฌ ํ์ด์ง๋ ๋ธ๋ก๊ทธ์ ์ฒซ์ธ์์ ๊ฒฐ์ ์ง๋ ํต์ฌ ์์์ ๋๋ค. ํนํ ์ฝํ ์ธ ์ค์ฌ ํ๋ซํผ์์๋ ์นดํ ๊ณ ๋ฆฌ์ ๊ตฌ์กฐ์ ๋์์ธ๋ง์ผ๋ก๋ ๋ฐฉ๋ฌธ์์ ํด๋ฆญ๋ฅ ๊ณผ ์ฒด๋ฅ ์๊ฐ์ ์ข์ฐํ ์ ์์ต๋๋ค. ์ด๋ฒ ํฌ์คํธ์์๋ ์ฌ๋ฏธ์ฑ, UX(์ฌ์ฉ์ ๊ฒฝํ), ๋ชจ๋ฐ์ผ ๋์์ฑ์ ๋ชจ๋ ๊ฐ์ถ ์ด์ 4๊ฐ์ง ์คํ์ผ์ ์นดํ ๊ณ ๋ฆฌ ๋์์ธ์ ์๊ฐํ๊ณ , ๋ฐ๋ก ํ์ฉ ๊ฐ๋ฅํ HTML ์ฝ๋ ํ ํ๋ฆฟ์ ํจ๊ป ์ ๊ณตํฉ๋๋ค.
๋ฐ์ํ ๋ธ๋ก๊ทธ ์นดํ ๊ณ ๋ฆฌ ๋์์ธ์ ํต์ฌ ์์์ ๊ตฌ์กฐ
์นดํ ๊ณ ๋ฆฌ ๋์์ธ์ ํต์ฌ ์์
์นดํ ๊ณ ๋ฆฌ ํ์ด์ง๋ ๋ ์์๊ฒ ์ฝํ ์ธ ํ๋ฆ์ ์๋ดํ๋ ๋ค๋น๊ฒ์ด์ ํ๋ธ์ด์, ์ ์ฒด ๋ธ๋ก๊ทธ ๋ธ๋๋ฉ์ ์์ฑํ๋ ์๊ฐ์ ์์์ ๋๋ค. ํต์ฌ์ ์ธ ๋์์ธ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ํ ์คํธ์ ๊ท ํ๊ฐ ์๋ ๋ฐฐ์น
- PC/๋ชจ๋ฐ์ผ ๋ชจ๋ ๋์ ๊ฐ๋ฅํ ๋ฐ์ํ ๊ตฌ์กฐ
- ์นดํ ๊ณ ๋ฆฌ๋ช , ๋ฐํ์ผ, ์์ฝ ์ค๋ช ๋ฑ์ ์ ๋ณด ์ ๋ฌ
ํตํฉ CSS ์ฝ๋ (CSS ์ถฉ๋ ๋ฐฉ์ง์ฉ my-cat- ์ ๋์ฌ ์ ์ฉ)
์๋ ์ฝ๋๋ 4๊ฐ์ง ์คํ์ผ์ ๋ชจ๋ ๊ตฌํํ๊ธฐ ์ํ ๊ณตํต ์คํ์ผ๊ณผ ๋ฐ์ํ ๋ฏธ๋์ด ์ฟผ๋ฆฌ๊ฐ ํฌํจ๋ ์ ์ฒด CSS ์ฝ๋์ ๋๋ค. ์ด ์ฝ๋๋ฅผ ๋ธ๋ก๊ทธ ์คํจ์ CSS ํธ์ง ์์ญ์ ์ฝ์ ํ์ฌ ์ฌ์ฉํฉ๋๋ค.
/* CSS ๋ณ์ ์ค์ */
:root {
--my-cat-primary: #FF5E5B;
--my-cat-secondary: #00CECB;
--my-cat-dark: #2D3047;
--my-cat-light: #F5F5F5;
--my-cat-gray: #939393;
--my-cat-white: #FFFFFF;
}
.my-cat-container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
font-family: 'Noto Sans KR', sans-serif;
}
.my-cat-item {
margin-bottom: 3rem;
position: relative;
overflow: hidden;
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
transition: transform 0.4s, box-shadow 0.4s;
background-color: var(--my-cat-white);
}
.my-cat-item:hover {
transform: translateY(-8px);
box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}
.my-cat-item a {
text-decoration: none;
color: inherit;
display: block;
height: 100%;
}
.my-cat-thum {
overflow: hidden;
}
.my-cat-thum img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 12px;
transition: transform 0.5s;
display: block;
}
.my-cat-item:hover .my-cat-thum img {
transform: scale(1.03);
}
.my-cat-title {
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 0.8rem;
line-height: 1.3;
color: var(--my-cat-dark);
}
.my-cat-excerpt {
font-size: 1rem;
color: var(--my-cat-gray);
line-height: 1.6;
margin-bottom: 1.2rem;
}
.my-cat-category {
display: inline-block;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 1px;
color: var(--my-cat-primary);
margin-bottom: 0.5rem;
text-transform: uppercase;
}
.my-cat-meta {
font-size: 0.9rem;
color: var(--my-cat-gray);
}
.my-cat-date {
display: inline-block;
margin-top: 5px;
}
.my-cat-style-overlay {
position: relative;
height: 500px;
overflow: hidden;
}
.my-cat-full-image {
height: 100%;
position: relative;
}
.my-cat-overlay-text {
position: absolute;
bottom: 0;
padding: 2.5rem;
width: 100%;
color: white;
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
z-index: 2;
}
.my-cat-style-overlay .my-cat-title {
color: white;
font-size: 2.2rem;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.my-cat-style-overlay .my-cat-excerpt {
color: rgba(255,255,255,0.9);
font-size: 1.1rem;
}
.my-cat-top-right {
position: absolute;
top: 1.5rem;
right: 1.5rem;
color: white;
z-index: 10;
text-align: right;
}
.my-cat-top-right .my-cat-category {
color: white;
background-color: rgba(255, 94, 91, 0.8);
padding: 5px 10px;
border-radius: 4px;
}
.my-cat-top-right .my-cat-date {
color: rgba(255,255,255,0.9);
}
.my-cat-style-split .my-cat-split-layout {
display: flex;
height: 400px;
}
.my-cat-style-split .my-cat-text-box {
flex: 1;
padding: 2rem;
display: flex;
flex-direction: column;
justify-content: center;
}
.my-cat-style-split .my-cat-thum {
flex: 1;
height: 100%;
}
.my-cat-style-split .my-cat-thum img {
border-radius: 0 12px 12px 0;
height: 100%;
}
.my-cat-style-rightbox {
position: relative;
height: 450px;
}
.my-cat-bg-image {
height: 100%;
position: relative;
}
.my-cat-bg-image img {
border-radius: 12px;
height: 100%;
}
.my-cat-box-text {
position: absolute;
right: 3rem;
top: 50%;
transform: translateY(-50%);
background: rgba(16, 23, 67, 0.9);
padding: 2rem;
width: 40%;
color: white;
border-radius: 8px;
box-shadow: 0 5px 20px rgba(0,0,0,0.3);
z-index: 10;
}
.my-cat-white-text {
color: white;
}
.my-cat-style-grid {
padding: 3rem;
text-align: center;
}
.my-cat-text-center {
text-align: center;
}
.my-cat-image-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
margin: 2rem 0;
}
.my-cat-style-grid .my-cat-meta {
margin-top: 1rem;
text-align: center;
}
.my-cat-style-grid .my-cat-image-grid img {
height: 225px;
border-radius: 8px;
}
@media (max-width: 768px) {
.my-cat-container {
padding: 1rem;
}
.my-cat-item {
margin-bottom: 2rem;
}
.my-cat-title {
font-size: 1.5rem;
}
.my-cat-style-split .my-cat-split-layout {
flex-direction: column;
height: auto;
}
.my-cat-style-split .my-cat-thum {
order: -1;
}
.my-cat-style-split .my-cat-thum img {
border-radius: 12px 12px 0 0;
height: 250px;
}
.my-cat-style-rightbox {
height: auto;
}
.my-cat-bg-image img {
height: 300px;
}
.my-cat-box-text {
width: 90%;
right: 5%;
position: relative;
top: 0;
transform: none;
margin: -50px auto 20px;
background: rgba(16, 23, 67, 0.95);
}
.my-cat-image-grid {
grid-template-columns: 1fr;
}
.my-cat-style-overlay, .my-cat-style-rightbox {
height: 350px;
}
.my-cat-overlay-text {
padding: 1.5rem;
}
.my-cat-style-overlay .my-cat-title {
font-size: 1.8rem;
}
.my-cat-style-grid {
padding: 2rem 1.5rem;
}
}
@media (max-width: 480px) {
.my-cat-container {
padding: 0.5rem;
}
.my-cat-style-overlay, .my-cat-style-rightbox {
height: 300px;
}
.my-cat-style-overlay .my-cat-title {
font-size: 1.5rem;
}
.my-cat-box-text {
width: 95%;
right: 2.5%;
padding: 1.5rem;
}
}
Q1: ์ HTML/CSS ์ฝ๋๋ฅผ ํฐ์คํ ๋ฆฌ ๋ธ๋ก๊ทธ์ ์ด๋ป๊ฒ ์ ์ฉํด์ผ ํ๋์?
A1: CSS ์ฝ๋๋ ์คํจ ํธ์ง์ 'CSS' ์์ญ ๊ฐ์ฅ ํ๋จ์ ์ถ๊ฐํ๊ณ , HTML ์ฝ๋๋ 'HTML ํธ์ง' ์์ญ ์ค ์นดํ
๊ณ ๋ฆฌ ๋ชฉ๋ก(List Page)์ ๋ด๋นํ๋ ์นํ์(์: ์ฃผ๋ณ)๋ฅผ ์ฐพ์, ์ํ ๋ฐ์ดํฐ ๋์ ์ ์ ํ ํฐ์คํ ๋ฆฌ ์นํ์๋ฅผ ๋ค์ ์ฝ์
ํ์ฌ my-cat-item์ด ๋ฐ๋ณต ์ถ๋ ฅ๋๋๋ก ์์ ํด์ผ ํฉ๋๋ค. ํฐ์คํ ๋ฆฌ ์นํ์๋ฅผ ์ ์ ํ ํ์ฉํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
Q2: ์นดํ ๊ณ ๋ฆฌ ๋์์ธ์ ์์ ํ ๋ ๋ชจ๋ฐ์ผ ๋์(๋ฐ์ํ)์ด ์ค์ํ ์ด์ ๋ ๋ฌด์์ธ๊ฐ์?
A2: ํ์ฌ ๋๋ถ๋ถ์ ๋ธ๋ก๊ทธ ํธ๋ํฝ์ ๋ชจ๋ฐ์ผ ๊ธฐ๊ธฐ์์ ๋ฐ์ํฉ๋๋ค. ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ๋ ์ด์์์ด ๊นจ์ง๋ฉด ์ฌ์ฉ์ ๊ฒฝํ(UX)์ด ์ ํ๋๊ณ , ์ดํ๋ฅ ์ฆ๊ฐ ๋ฐ SEO ์ ์ ํ๋ฝ์ผ๋ก ์ด์ด์ง๋๋ค. ์ ๊ณต๋ ์ฝ๋์๋ @media (max-width: 768px) ์ฟผ๋ฆฌ๊ฐ ํฌํจ๋์ด ๋ชจ๋ฐ์ผ ํ๊ฒฝ์ ์ต์ ํ๋๋๋ก ๊ตฌ์ฑ๋์ด ์์ต๋๋ค.
Q3: ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ํฌ๊ธฐ์ ๋น์จ์ ๊ณ ์ ํ๋ ๊ฒ์ด ์ค์ํ๊ฐ์?
A3: ๋งค์ฐ ์ค์ํฉ๋๋ค. ์ธ๋ค์ผ ํฌ๊ธฐ๋ฅผ ๊ณ ์ ํ๊ฑฐ๋ object-fit ์์ฑ์ ์ฌ์ฉํด์ผ ์ด๋ฏธ์ง๊ฐ ๋ก๋ฉ๋ ๋ ์ฃผ๋ณ ๋ ์ด์์์ด ๋ฐ๋ฆฌ๋ CLS(Cumulative Layout Shift) ํ์์ ๋ฐฉ์งํ ์ ์์ต๋๋ค. ์ด๋ ์น ์ฑ๋ฅ ์งํ ๊ฐ์ ์ ํ์์ ์ด๋ฉฐ ์๊ฐ์ ์์ ์ฑ์ ํ๋ณดํ๋ ๋ฐ ๋์์ ์ค๋๋ค.