Menu
Coddy logo textTech

테마 설정

Coddy HTML 여정의 Practical Frontend 섹션에 포함된 레슨 — 35개 중 19번째.

challenge icon

챌린지

쉬움

이제 강조 색상과 일관된 타이포그래피를 추가하여 페이지의 테마 설정을 개선해 보겠습니다.

작업 내용:

  1. :root 내에 다음의 새로운 CSS 변수들을 정의하세요:

    --accent-color: #1e90ff;

     --heading-font: 'Arial', sans-serif;

     --body-font: 'Verdana', sans-serif;

  2. 페이지 전체에 이 변수들을 적용하세요:
    • body 텍스트에 --body-font를 사용하세요.
    • 제목(h1, h2)에 --heading-font를 사용하세요.
    • h2 색상을 --accent-color로 설정하세요.
    • 버튼의 배경색을 --accent-color로 스타일을 지정하세요.

목표: 이제 페이지는 일관된 글꼴과 제목 및 버튼에 적용된 강조 색상을 통해 명확한 테마를 갖추게 됩니다.

직접 해보기

<!DOCTYPE html>
<html>
<head>
  <title>Extreme Sports Adventures</title>
<style>
  /* === Variables for Theming === */
  :root {
    --primary-color: #ff4d4f;
    --secondary-color: #333;
    --bg-color: #f7f7f7;
    --text-color: #222;
    --card-bg: #ffffff;
  }

  body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
  }

  header {
    text-align: center;
    padding: 2rem 1rem;
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
  }

  header p {
    margin: 0;
    font-size: 1.1rem;
  }

  main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .hero {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }

  .hero img {
    width: 100%;
    height: 350px;
    object-fit: cover;
  }

  .description, .facts {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  .description h2, .facts h2 {
    margin-top: 0;
  }

  .btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 10px 20px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    transition: transform 0.3s, background-color 0.3s;
  }

  .btn:hover {
    background-color: var(--primary-color);
    transform: scale(1.05);
  }

  ul {
    padding-left: 20px;
  }
</style>
</head>
<body>
<header>
  <h1>Extreme Sports Adventures</h1>
  <p>Feel the adrenaline with the world's most thrilling sports!</p>
</header>

<main>
  <section class="hero">
     <picture>
      <source media="(min-width: 768px)" srcset="https://upload.wikimedia.org/wikipedia/commons/3/32/Parachuting_sport.jpg">
      <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Parachuting_sport.jpg/960px-Parachuting_sport.jpg" alt="Skydiving">
    </picture>
  </section>

  <section class="description">
    <h2>What is Extreme Sports?</h2>
    <p>Extreme sports are activities that involve high risks and adrenaline. From skydiving and rock climbing to snowboarding and bungee jumping, these sports push your limits and give an unforgettable thrill.</p>
    <a href="#" class="btn">Learn More</a>
  </section>

  <section class="facts">
    <h2>Fun Facts</h2>
    <ul>
      <li>Skydiving reaches speeds over 120 mph during free fall.</li>
      <li>Bungee jumping started as a ritual in Vanuatu called "land diving."</li>
      <li>Rock climbing requires both strength and strategy.</li>
      <li>Snowboarding evolved from surfing and skateboarding.</li>
    </ul>
  </section>
</main>
</body>
</html>

Practical Frontend의 모든 레슨