開発用
テストページ(HTML)
INDEX
目次
@Toshiki_Aoki HTML実践課題 | WEBCOACH
HTML実践課題
index.html
プレビュー
\n`, checks: [ { desc: "DOCTYPE宣言がある", test: (doc, code) => //i.test(code) }, { desc: " タグがある", test: (doc, code) => doc.querySelector('html') !== null }, { desc: " タグがある", test: (doc, code) => doc.querySelector('head') !== null }, { desc: " タグがある", test: (doc, code) => doc.querySelector('body') !== null }, { desc: "

に「はじめてのHTML」と書かれている", test: (doc) => { const h1 = doc.querySelector('h1'); return h1 && h1.textContent.includes('はじめてのHTML'); }} ] }, { id: 2, title: "見出しと段落", goal: "見出しタグ(h1〜h3)と段落タグ(p)を使い分けられるようになる", instructions: `

見出しタグ

  • <h1> … 最も大きな見出し(ページに1つ)
  • <h2> … 中見出し
  • <h3> … 小見出し

数字が小さいほど重要な見出しです。

段落タグ

<p> タグで文章のまとまり(段落)を表します。

課題

自己紹介ページを作りましょう:

  • <h1> で名前を書く
  • <h2> で「自己紹介」と書く
  • <p> で自己紹介文を書く
  • <h2> で「趣味」と書く
  • <p> で趣味の説明を書く
`, hint: `見出しと段落を交互に使いましょう。

<h1>山田太郎</h1>
<h2>自己紹介</h2>
<p>Webデザインを勉強中です。</p>
のように書きます。`, initialCode: `\n\n\n 自己紹介\n \n\n \n \n \n \n \n \n \n \n \n \n \n`, checks: [ { desc: "

タグがある(名前)", test: (doc) => { const h1 = doc.querySelector('h1'); return h1 && h1.textContent.trim().length > 0; }}, { desc: "

タグが2つ以上ある", test: (doc) => doc.querySelectorAll('h2').length >= 2 }, { desc: "

タグが2つ以上ある", test: (doc) => doc.querySelectorAll('p').length >= 2 }, { desc: "「自己紹介」の見出しがある", test: (doc) => { const h2s = doc.querySelectorAll('h2'); return [...h2s].some(h => h.textContent.includes('自己紹介')); }}, { desc: "「趣味」の見出しがある", test: (doc) => { const h2s = doc.querySelectorAll('h2'); return [...h2s].some(h => h.textContent.includes('趣味')); }} ] }, { id: 3, title: "リスト", goal: "順序なしリスト(ul)と順序ありリスト(ol)を作れるようになる", instructions: `

2種類のリスト

  • <ul> … 順序なしリスト(・で表示)
  • <ol> … 順序ありリスト(1. 2. 3. で表示)
  • <li> … リストの各項目

書き方

<ul> または <ol> の中に <li> を並べます。

課題

以下の2つのリストを作ってください:

  • <h2> で「好きな食べ物」→ <ul> で3つ以上
  • <h2> で「朝のルーティン」→ <ol> で3つ以上
`, hint: `<ul>(順序なし)と <ol>(順序あり)の違いに注意!

<ul>
 <li>カレー</li>
 <li>ラーメン</li>
</ul>`, initialCode: `\n\n\n リスト練習\n \n\n

わたしのリスト

\n\n \n \n\n \n \n\n \n`, checks: [ { desc: "