6月教科書:CSSで入力しやすい旅行日記フォームを作ろう

対象:小学6年生(hitoクラス)


0. 今月のゴール

今月は、旅行日記の「書き込み画面」を 入力しやすく、見やすく します。

まずは練習用で作って、よくなったら公開版で検証して、本番に反映します。


1. 今月の進め方(順番固定)

  1. Bootstrapを適用する
  2. hito-style.css を適用する
  3. 日付 → 場所 → 何をしたか の順で、1つずつ適用して確認する
  4. ボタンをBootstrapから選ぶ
  5. 見出し h1 をデザインする
  6. 背景色を自分で選ぶ
  7. 残りを仕上げる(余白・幅・見やすさ)
ポイント:1か所変えたら、必ず画面を見て確認 してから次へ進む。

2. 準備:BootstrapとCSSファイルを読みこむ

2-1. hito-travel-post.html の <head> にBootstrapを追加

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>旅行日記 — 新しく書く</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="hito-style.css">

    <script src="hito-travel-post.js" defer></script>
</head>

2-2. 最初の確認


3. ステップ1:日付入力(#inputDate)

最初は日付だけに適用します。

<label for="inputDate" class="form-label">日付</label>
<input type="date" id="inputDate" class="form-control">

確認ポイント


4. ステップ2:場所入力(#inputPlace)

次に場所へ適用します。

<label for="inputPlace" class="form-label">場所</label>
<input type="text" id="inputPlace" class="form-control" placeholder="例: 東京スカイツリー">

確認ポイント


5. ステップ3:何をしたか(#inputAct)

最後にテキストエリアへ適用します。

<label for="inputAct" class="form-label">何をしたか</label>
<textarea id="inputAct" class="form-control" rows="4" placeholder="例: 展望台からけしきを見た"></textarea>

確認ポイント


6. ステップ4:ボタンをBootstrapから選ぶ

#sendButton にボタンデザインをつけます。

<button id="sendButton" class="btn btn-primary">サーバーに送る</button>

ためしてよい例

確認ポイント


7. ステップ5:見出し h1 をデザインする

ここから hito-style.css を使って自分のデザインを足します。

hito-style.css 例:

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1d3557;
    margin-bottom: 0.75rem;
}

確認ポイント


8. ステップ6:背景色を自分で選ぶ

body に背景色をつけます。

body {
    background-color: #f5f9ff;
}

色の候補

確認ポイント


9. ステップ7:残り設定(仕上げ)

最後に全体のバランスを整えます。

hito-style.css 例:

main, .travel-form-wrap {
    max-width: 720px;
    margin: 24px auto;
    padding: 16px;
}

label {
    margin-top: 12px;
}

#result-area {
    margin-top: 16px;
    padding: 12px;
    border: 1px dashed #9aa4b2;
    background: #ffffff;
}

a {
    display: inline-block;
    margin-top: 12px;
}

HTML側に main や div class="travel-form-wrap" をつけると整えやすいです。

確認ポイント


10. 公開版での検証手順(必ず実施)

  1. 練習用 hito-travel-post.html で完成させる
  2. 同じ変更を travel-post.html に反映する
  3. 公開版で表示確認する
  4. 問題なければ hitoユーザーの /www 本番HTMLへ反映する

最終チェック


11. 今月のミッション


12. 先生メモ(つまずきやすい点)