whatisthis?
Project. ๋ฐ์ํ ํ์ด์ง - (4) Program Section โก ๋ณธ๋ฌธ
(4) Program Section
๐ HTML + CSS ์์ฑ
- html ๋งํฌ์ ๊ตฌ์ฑ
์ง๋ ํฌ์คํ ์์ ๋ง๋ strong+h1+p ๊ตฌ์ฑ์ด ํ๊ฐ์ row์๋ค๋ฉด
์๋ก์ด row๋ฅผ ๋ง๋ค์ด์ฃผ๊ณ ,
col-12๋ฅผ ์ด 3๊ฐ ๋ง๋ค์ด col-md-4 ๋ก ์ง์ ํด์ค๋ค.
<div class="row">
<div class="col-12 col-md-4"></div>
<div class="col-12 col-md-4"></div>
<div class="col-12 col-md-4"></div>
</div>
<div class="row">
<div class="col-12 col-md-4"></div>
<div class="col-12 col-md-4"></div>
<div class="col-12 col-md-4"></div>
</div>
์ง๊ธ๊น์ง section.program ์ ๊ตฌ์ฑ์ ์ดํด๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
section > container > row > col-12 (col-md-10)
> row > col-12 (col-md-4) * 3
index.html
<div class="row">
<div class="col-12 col-md-4">
<a href="#" class="program-card">
<img src="./assets/img-fulltime-campus.png" alt="" />
<strong>Full-Time On Campus</strong>
</a>
</div>
<div class="col-12 col-md-4">
<a href="#" class="program-card">
<img src="./assets/img-fulltime-remote.png" alt="" />
<strong>Full-Time Remote</strong>
</a>
</div>
<div class="col-12 col-md-4">
<a href="#" class="program-card">
<img src="./assets/img-parttime-flex.png" alt="" />
<strong>Part-Time Flex</strong>
</a>
</div>
</div>
style.css
/* Program Page */
.program-card {
display: block;
text-align: center;
width: 290px;
padding: 24px 0 32px;
border-radius: 8px;
background-color: #fff;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 4px 6px rgba(0, 0, 0, 0.05),
inset 0px 1px 0px rgba(255, 255, 255, 0.1);
}
.program-card img {
display: block;
width: auto;
height: 195px;
margin: 0 auto 16px;
}
.program-card strong {
font-size: 18px;
line-height: 1.33333333;
letter-spacing: -0.02em;
}
์ฌ๊ธฐ์, program-card๋ ์๋ aํ๊ทธ๋ผ์ display: block์ด๋ flex๋ ํด์ค์ผํจ. (border-radius๋ width ์ค์ ์ ์ํด)
๋ ์ฒ์์ flex ํ๊ณ align-item: center. justify-content: center ํด์ ๊ฐ์ด๋ฐ ์ ๋ ฌ ํด์คฌ์ง๋ง
์ด๋ฒ์ display: blockํ๊ณ text-align: center๋ก >> strong ๊ฐ์ด๋ฐ์ ๋ ฌ
img๋ ์ฐ๋ฆฌ๊ฐ height ์ค์ ์ ์ํด display: block์ผ๋ก ๋ฐ๋์๊ธฐ ๋๋ฌธ์, margin: 0 auto๋ฅผ ์ค๋ค.
(block ๊ฐ์ด๋ฐ์ ๋ ฌ์ ์ด๋ ๊ฒ ํจ.)
+) hover ์คํ์ผ ์ ์ฉ
.program-card:hover {
background-color: #3141c5;
box-shadow: 0px 13px 18px rgba(0, 0, 0, 0.15),
0px 11px 55px rgba(0, 0, 0, 0.07);
}
.program-card:hover strong {
color: #fff;
}
.program-card {
/* ์๋ต */
transition: background-color 300ms ease-in-out, box-shadow 300ms ease-in-out;
}
๐ป program page ์ ์ฒด CSS
/* Program Page */
.program .row:first-child {
margin-bottom: 32px;
}
.program .col-md-4 {
margin-bottom: 20px;
}
.program .col-md-4:last-child {
margin-bottom: 0;
}
.program .section-category {
color: #009b4d;
}
.program-card {
display: block;
width: 290px;
padding: 24px 0 32px;
border-radius: 8px;
text-align: center;
background-color: #fff;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 4px 6px rgba(0, 0, 0, 0.05),
inset 0px 1px 0px rgba(255, 255, 255, 0.1);
transition: background-color 300ms ease-in-out, box-shadow 300ms ease-in-out;
}
.program-card:hover {
background-color: #3141c5;
box-shadow: 0px 13px 18px rgba(0, 0, 0, 0.15),
0px 11px 55px rgba(0, 0, 0, 0.07);
}
.program-card:hover strong {
color: #fff;
}
.program-card img {
display: block;
width: auto;
height: 195px;
margin: 0 auto 16px;
}
.program-card strong {
font-size: 18px;
line-height: 1.33333333;
letter-spacing: -0.02em;
transition: color 500ms ease-in-out;
}
+ ๋ฏธ๋์ด์ฟผ๋ฆฌ (desktop ๋ถ๋ถ)
/* >= 768px (Desktop) */
@media screen and (min-width: 768px) {
/* ๐บ ์๋ต */
/* Program */
.program {
text-align: center;
}
.program .row:first-child {
margin-bottom: 72px;
}
.program-card img {
margin-bottom: 24px;
}
.program-card strong {
font-size: 20px;
line-height: 1.2;
}
}
+)
๊ฐ์์์ ์ํ์ง๋ง, ๋๋
.program-card์ width: 100%๋ฅผ ์ถ๊ฐํ๋ค.
๐ป Design File
๐ปReference Lecture
'PROJECT > WEB' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Project. ๋ฐ์ํ ํ์ด์ง - (6) Subscription Section (0) | 2022.03.02 |
---|---|
Project. ๋ฐ์ํ ํ์ด์ง - (5) Curriculum Section (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (4) Program Section (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (3) Service Section (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (2) landing page (0) | 2022.03.02 |