0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【フロントエンド1000本ノック】0055_gapプロパティ(row-gap, column-gap)を使い、グリッドアイテム間の溝のサイズを指定せよ。

Posted at

この記事は人間が書きました

はじめに

こんにちは、赤神です!
この記事は、「1000本ノック」という取り組みの中のフロントエンドのための課題の1つです。

「1000本ノックとは」
https://qiita.com/sora_akagami/items/c8da4296dea3823376ca

gapプロパティ とは

gap プロパティは、グリッドの行と列の間の溝(Gutter)のサイズを指定するための、非常にシンプルで強力な機能です。これまではアイテムに margin に指定していましたが、gap を使えばアイテムの外側ではなく、グリッドライン自体にスペースを作ることができます。

  • columns-gap:列と列の間の溝のサイズを指定
  • row-gap:行と行の間の溝のサイズを指定
  • gaprow-gapcolumns-gap を一行で指定できるショートハンド
    • gap: 20px;:行と列の両方に 20px の溝
    • gap: 20px 30px;:行に 20px、列に 30px の溝

作成したコード

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>フロントエンド1000本ノック 0055</title>
</head>
<body style="display: flex; flex-direction: column; min-height: 100vh;">

  <header style="display: flex; justify-content: space-between; align-items: center;">
    <div>
      <a href="/">
        <img src="img/logo.png" alt="フロントエンド1000本ノック">
      </a>
    </div>

    <nav>
      <ul style="display: flex; list-style: none; gap: 20px;">
        <li><a href="#">ホーム</a></li>
        <li><a href="#">会社概要</a></li>
        <li><a href="#">お問い合わせ</a></li>
      </ul>
    </nav>
  </header>

  <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
    <div>7</div>
    <div>8</div>
    <div>9</div>
  </div>

  <footer>
    <p>Copyright 2025</p>
    <p>フロントエンド1000本ノック</p>
  </footer>

</body>
</html>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?