← レベル1 – ビルダー

レッスン 2/12 ⏱ 25 分

見出し、段落、リスト

ページに本物のコンテンツを入れて、きれいに整理する方法を学ぼう。

見てみよう:コンテンツには専用のタグがある

HTML にはコンテンツの種類ごとに専用のタグがある。よく使うのはこれ:

<h1>Main heading – only once per page</h1>
<h2>A chapter heading</h2>
<h3>A smaller heading inside a chapter</h3>

<p>An ordinary paragraph of text.</p>
<p>Another paragraph. Every paragraph gets its own <p> tag.</p>

<p>You can <strong>make words bold</strong> or <em>italic</em>.</p>

見出しは <h1>(最大)から <h6>(最小)まで。ノートみたい:<h1> が表紙のタイトル、<h2> が章、<h3> が小見出し。

リスト

<!-- A bulleted list (ul = unordered list) -->
<ul>
  <li>first thing</li>
  <li>second thing</li>
</ul>

<!-- A numbered list (ol = ordered list) -->
<ol>
  <li>step one</li>
  <li>step two</li>
</ol>

各項目は <li>、全体は <ul>(箇条書き)か <ol>(番号付き)で囲む。

💡

変な行 <!— text —>コメント——自分用のメモ、ブラウザは無視する。プログラマーはこうやってコードにメモを残す。

やってみよう 💪

ホームページにコンテンツを入れよう。必要なもの:

  1. <h1> が1つ(もうあるはず)、
  2. 少なくとも2つの章——<h2> 見出しと段落、
  3. リストが1つ以上(<ul><ol>)、
  4. <strong> で太字にしたもの。

プロジェクトごとのアイデアと答え:

🏫 学校サイト——アイデアと答え

章の例:学校について予定、クラブのリスト。

<h1>Riverside Elementary School</h1>
<p>Welcome to our school's website.</p>

<h2>About Our School</h2>
<p>Our school has stood in Riverside for <strong>120 years</strong>. We have
350 students, a big gym, and a brand-new computer lab.</p>

<h2>Clubs</h2>
<ul>
  <li>floorball</li>
  <li>ceramics</li>
  <li>coding</li>
  <li>choir</li>
</ul>

<h2>Coming Up</h2>
<ol>
  <li>outdoor school (June)</li>
  <li>sports day</li>
  <li>winter fair</li>
</ol>
🙋 個人サイト——アイデアと答え

章の例:好きなことできること、好きなゲームや本のリスト。

<h1>Hi, I'm Jake</h1>
<p>I'm 10 years old and this is my website.</p>

<h2>What I Like</h2>
<p>More than anything, I love <strong>soccer</strong> – I play for the youth team.
At home I build worlds in Minecraft and I'm learning to code.</p>

<h2>My Top Games</h2>
<ol>
  <li>Minecraft</li>
  <li>Mario Kart</li>
  <li>Rocket League</li>
</ol>

<h2>What I Can Do</h2>
<ul>
  <li>juggle a soccer ball</li>
  <li>make pancakes</li>
  <li>build a website (right now!)</li>
</ul>
🌍 旅行日記——アイデアと答え

章の例:前回の旅行次の予定、行った国のリスト。

<h1>Where We've Been 🌍</h1>
<p>A journal of our trips and adventures.</p>

<h2>Last Trip: The Mountains</h2>
<p>Over the summer we hiked <strong>the whole ridge</strong>. Three days of
walking, one wrong turn, and a hundred wild berries.</p>

<h2>Countries I've Visited</h2>
<ul>
  <li>United States</li>
  <li>Canada</li>
  <li>Mexico</li>
  <li>Italy</li>
</ul>

<h2>Next Year's Plan</h2>
<ol>
  <li>camping by the lake</li>
  <li>mountains out west</li>
  <li>the beach in Greece</li>
</ol>
⚽ クラブサイト——アイデアと答え

章の例:クラブについて最近の結果、メンバーリスト。

<h1>Riverside Eagles FC</h1>
<p>The official website of our soccer club.</p>

<h2>About the Club</h2>
<p>We play in the district youth league. We train
<strong>Tuesdays and Thursdays at 5:00 PM</strong> on the field behind the school.</p>

<h2>Recent Results</h2>
<ol>
  <li>Eagles – Hawks 3 : 1</li>
  <li>Falcons – Eagles 2 : 2</li>
  <li>Eagles – Wildcats 4 : 0</li>
</ol>

<h2>Roster</h2>
<ul>
  <li>Jake – goalkeeper</li>
  <li>Matt – defense</li>
  <li>Owen – midfield</li>
  <li>Tom – forward</li>
</ul>

確認: ページに大見出し、章見出し、段落、箇条書きか番号リストが1つ以上ある。まだ素っ裸だけど、本物のサイトみたいに見える。

このレッスンのまとめ