Web白描

Webデザインの勉強 - 演習

PHOTO BOOK

PHOTO BOOK

記述例

index.html

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>【コーディング練習】PHOTO BOOK</title>
<link rel="icon" href="img/favicon.ico">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100..900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>

<!-- ▼ header -->
<header class="header">

  <div class="container">
    <h1><img src="img/logo.svg" alt="PHOTO BOOK"></h1>
  </div><!-- /.container -->

</header>
<!-- ▲ header -->

<!-- ▼ main -->
<main class="main">

  <div class="container">

    <picture>
      <source media="(max-width: 600px)" srcset="img/main_visual-sp.webp">
      <img src="img/main_visual.webp" alt="">
    </picture>

    <!-- section.index -->
    <section class="index">
      <h2>INDEX</h2>
      <ol>
        <li>人生の一コマ
          (A Moment in Life)</li>
        <li>視点から見える世界
          (The World Through Our Lens)</li>
        <li>永遠の記憶
          (Eternal Memories)</li>
        <li>瞬間の彩り
          (Hues of a Moment)</li>
        <li>視点の旅路
          (Journey Through the Lens)</li>
      </ol>
    </section>
    
    <!-- section.detail -->
    <section class="detail">
      <h2>DETAIL</h2>
      <div class="detail_wrap">
        <p class="photo"><img src="img/detail.webp" alt=""></p>
        <div class="info">
          <h3>PHOTO BOOK</h3>
            <dl>
              <dt>著者:</dt>
              <dd>田中 景子 (たなか けいこ)</dd>
              <dt>出版社:</dt>
              <dd>ALASKA BEAR TALES</dd>
              <dt>発行年:</dt>
              <dd>2024年1月1日</dd>
            </dl>
            <p>自然の中に完全に溶け込み、長時間じっくりと被写体を観察することで、最高の一瞬を逃さずに捉えることができます。</p>
            <a class="link" href="#">オンラインストアで見る</a>
          </div><!-- /.info -->
      </div><!-- /.detail_wrap -->
    </section><!-- /.detail -->

  </div><!-- /.container -->

</main>
<!-- ▲ main -->

<!-- ▼ footer -->
<footer class="footer">

  <div class="container">
    <p><small>© 2025 PHOTO BOOK</small></p>
  </div><!-- /.container -->
  
</footer>
<!-- ▲ footer -->

</body>
</html>

style.css

@charset "UTF-8";

/* ---------------------------------------
  reset
--------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
ul {
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  vertical-align: bottom;
}
html {
  font-size: 100%;
}


/* ---------------------------------------
  body
--------------------------------------- */
body {
  background-color: #ecedee;
  color: #333;
  font-size: 1.0rem;
  font-family: "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
  line-height: 1.0;
}


/* ---------------------------------------
  layout
--------------------------------------- */
.container {
  width: min(94%, 1000px);
  margin: 0 auto;
}


/* ---------------------------------------
  header
--------------------------------------- */
.header h1 {
  margin: 46px 0 14px 4px;
}
  h1 img {
    width: 160px;
  }


/* ---------------------------------------
  main
--------------------------------------- */
h2 {
  margin-bottom: 12px;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.0;
  text-align: center;
}


/* --------------- index -------------- */
.index {
  background-color: #fff;
  margin: 30px 0;
  padding: 20px 0 10px;
}
  .index > ol {
    padding: 0 1rem 0 4rem;
  }
    .index li {
      margin-bottom: 10px;
      line-height: 1.3;
      white-space: pre-line;
    }

@media screen and (min-width: 768px) {
  .index {
    margin: 40px 0;
    padding: 34px 20%;
  }
    .index > ol {
      padding: 0;
    }
      .index li {
        margin: 16px 0 6px;
        white-space: initial;
      }
}


/* -------------- detail ------------- */
.detail {
  width: min(80%, 960px);
  margin: 0 auto;
}
  .detail_wrap {
    display: block;
    max-width: 80%;
    margin: auto;
  }
    .detail > h2 {
      text-align: center;
    }
    .detail_wrap > .photo {
      width: 100%;
      height: 100%;
      margin-bottom: 30px;
    }

@media screen and (min-width: 768px) {
  .detail_wrap {
    display: grid;
    grid-template-columns: 46% auto;
    gap: 10%;
    width: min(88%, 600px);
    margin-inline: auto;
  }
    .detail > h2 {
      margin-bottom: 20px;
      margin-left: 25%;
      font-size: 1.375rem;
      text-align: left;
    }
}


/* -------------- info ------------- */
  .info {
    font-size: 0.875rem;
    line-height: 1.7;
  }
  .info h3 {
    padding-bottom: 6px;
    border-bottom: 1px solid #ccc;
    font-size: 1.25rem;
  }
    .info dl {
      display: grid;
      grid-template-columns: 25% 75%;
      margin-bottom: 14px;
      padding: 14px 0;
      border-bottom: 1px solid #ccc;
    }
    .info > p {
      margin-bottom: 30px;
      line-height: 1.6;
    }
    .link {
      text-decoration: underline;
    }
    
@media screen and (min-width: 768px) {
  .info h3 {
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
    font-size: 1.25rem;
  }
}


/* ---------------------------------------
  footer
--------------------------------------- */
.footer {
  padding: 60px 0 30px 3%;
  text-align: center;
}

@media screen and (min-width: 768px) {
  .footer {
    text-align: left;
  }
}