対象:小学6年生(hitoクラス)
今月は、旅行日記の「書き込み画面」を 入力しやすく、見やすく します。
/www/hito/hito-travel-post.html/www/hito/travel-post.htmlhitoユーザーの /wwwまずは練習用で作って、よくなったら公開版で検証して、本番に反映します。
hito-style.css を適用するh1 をデザインするポイント: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>
#inputDate)最初は日付だけに適用します。
<label for="inputDate" class="form-label">日付</label>
<input type="date" id="inputDate" class="form-control">
#inputPlace)次に場所へ適用します。
<label for="inputPlace" class="form-label">場所</label>
<input type="text" id="inputPlace" class="form-control" placeholder="例: 東京スカイツリー">
#inputAct)最後にテキストエリアへ適用します。
<label for="inputAct" class="form-label">何をしたか</label>
<textarea id="inputAct" class="form-control" rows="4" placeholder="例: 展望台からけしきを見た"></textarea>
#sendButton にボタンデザインをつけます。
<button id="sendButton" class="btn btn-primary">サーバーに送る</button>
btn btn-successbtn btn-warningbtn btn-outline-primaryh1 をデザインするここから hito-style.css を使って自分のデザインを足します。
hito-style.css 例:
h1 {
font-size: 2rem;
font-weight: 700;
color: #1d3557;
margin-bottom: 0.75rem;
}
body に背景色をつけます。
body {
background-color: #f5f9ff;
}
#f5f9ff#f2fff6#fffaf2最後に全体のバランスを整えます。
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" をつけると整えやすいです。
hito-travel-post.html で完成させるtravel-post.html に反映するhitoユーザーの /www 本番HTMLへ反映するh1 と背景色が読みやすいhito-style.css で「自分らしい見た目」にするfor="inputDate" と id="inputDate" の対応を合わせるbootstrap のあとに hito-style.css を読む