Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ チャレンジ:機能的なHTMLテーブルの設計 | HTMLフォームとユーザー入力
究極のHTML

チャレンジ:機能的なHTMLテーブルの設計

メニューを表示するにはスワイプしてください

目標

従業員情報を構造化されたテーブル形式で提示し、適切なHTMLタグを使用して行と列を作成する。

課題

3つの列(NamePositionWage)を持つテーブルを作成する。適切なHTMLタグを使用して、正しい行と列でテーブルを構成することに重点を置く。 以下のデータを含める:

  1. Name: Emma Johnson | Position: Sales Associate | Wage: $15.50 per hour
  2. Name: Liam Thompson | Position: Customer Service Representative | Wage: $14.75 per hour
  3. Name: Olivia Rodriguez | Position: Marketing Coordinator | Wage: $18.25 per hour
  4. Name: Noah Smith | Position: IT Support Specialist | Wage: $20.00 per hour
  5. Name: Ava Davis | Position: Administrative Assistant | Wage: $16.80 per hour
index.html

index.html

index.css

index.css

ヒント
expand arrow
  1. <table> タグを使用してテーブルのメインコンテナを定義する;
  2. <thead> タグを使用して、列見出しなどテーブルのヘッダー内容をグループ化する;
  3. <tr> タグを使用してテーブル内の新しい行を定義する;
  4. <th> タグを使用して各列のヘッダーテキストを定義する;
  5. <tbody> タグを使用して、行やデータセルを含むテーブルの主な内容をグループ化する;
  6. <td> タグを使用して各テーブルセル内の実際のデータや内容を定義する。
解答例
expand arrow
<!DOCTYPE html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <table>
      <!-- Table header: Defines the column headings -->
      <thead>
        <tr>
          <th>Name</th>
          <th>Position</th>
          <th>Wage</th>
        </tr>
      </thead>

      <!-- Table body: Contains data for each employee -->
      <tbody>
        <!-- Row 1 -->
        <tr>
          <td>Emma Johnson</td>
          <td>Sales Associate</td>
          <td>$15.50 per hour</td>
        </tr>
        <!-- Row 2 -->
        <tr>
          <td>Liam Thompson</td>
          <td>Customer Service Representative</td>
          <td>$14.75 per hour</td>
        </tr>
        <!-- Row 3 -->
        <tr>
          <td>Olivia Rodriguez</td>
          <td>Marketing Coordinator</td>
          <td>$18.25 per hour</td>
        </tr>
        <!-- Row 4 -->
        <tr>
          <td>Noah Smith</td>
          <td>IT Support Specialist</td>
          <td>$20.00 per hour</td>
        </tr>
        <!-- Row 5 -->
        <tr>
          <td>Ava Davis</td>
          <td>Administrative Assistant</td>
          <td>$16.80 per hour</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  21

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  21
some-alt