whatisthis?

Project. ๋ฐ˜์‘ํ˜• ํŽ˜์ด์ง€ - (4) Program Section โ‘ก ๋ณธ๋ฌธ

PROJECT/WEB

Project. ๋ฐ˜์‘ํ˜• ํŽ˜์ด์ง€ - (4) Program Section โ‘ก

thisisyjin 2022. 3. 2. 17:15

(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

 

Figma

Created with Figma

www.figma.com

 

๐Ÿ”ปReference Lecture

 

๊น€๋ฒ„๊ทธ์˜ HTML&CSS๋Š” ์žฌ๋ฐŒ๋‹ค - ๊ตฌ๋ฆ„EDU

HTML&CSS๋ฅผ ํ•œ๋ฒˆ์—! ํƒ„ํƒ„ํ•œ ๊ฐœ๋…์ดํ•ด๋ถ€ํ„ฐ ์‹ค์Šต๊นŒ์ง€ ํ•œ ๊ฐ•์˜๋กœ ๋๋‚ด๊ธฐ, ์‹ค๋ฌด ๊ฐ€๋Šฅํ•œ ์‹ค๋ ฅ์œผ๋กœ ๐Ÿ˜Ž

edu.goorm.io