Skip to content · ⁨コンテンツへスキップ⁩
Subjects · ⁨科目⁩
  • 1 HTML basics · ⁨HTMLの基礎⁩
    1.1

    Your first page

    English

    HTML 超文本标记语言 describes a web page with tags 标签. A tag is a word in angle brackets, like <p>. Most come in pairs — an opening tag <p> and a closing tag </p> wrap some content. A tag plus its content is an element 元素.

    • The browser draws whatever is between the tags.
    • A tag you forget to close, or spell wrong, may not show correctly.
    日本語

    HTMLはタグを使ってウェブページを記述します。タグは角括弧で囲まれた単語で、例として <p> があります。ほとんどのタグはペアになっており、開きタグ <p> と閉じタグ </p> がコンテンツを包み込みます。タグとそのコンテンツのセットを要素と呼びます。

    <p>Hello, world!</p>
    <p>This is my first web page.</p>
    
    • ブラウザはタグ間に書かれた内容进行を描写します。
    • 閉じタグを忘れたり、スペルが間違ったりすると、正しく表示されないことがあります。

    One element = opening tag + content + closing tag One element = opening tag + content + closing tag → 一つの要素 = 開始タグ + 内容 + 終了タグ

    1.2

    Headings & paragraphs

    English

    Headings 标题 run from <h1> (biggest) down to <h6> (smallest). A paragraph 段落 is <p>. Use exactly one <h1> for the page's main title.

    日本語

    見出しは <h1> (最大)から <h6> (最小)まであります。段落は <p> です。ページのメインタイトルには <h1> を1つだけ使用してください。

    <h1>My Blog</h1>
    <h2>About me</h2>
    <p>I am learning to build web pages.</p>
    
    1.3

    Text formatting

    English

    Make text bold 加粗 with <strong> and italic 斜体 with <em>. A line break 换行 is <br> — it has no closing tag.

    Common mistakes

    • Most tags come in pairs — <p>...</p>. Forgetting the closing tag breaks the layout below it.
    • The tag goes in angle brackets; the text you see goes between the opening and closing tags.
    • Headings run <h1> (biggest) to <h6> — do not pick a heading just for its size.
    日本語

    文字を太字にするには <strong> を、イタリックにするには <em> を使います。改行は <br> で、閉じタグはありません。

    <p><strong>Warning:</strong> read this carefully.</p>
    <p>First line<br>second line</p>
    <p>You can <em>emphasise</em> any word.</p>
    

    ** 一般的なミス **

    • ほとんどのタグはペアになります(<p>...</p>)。閉じタグを忘れると、以下のレイアウトが崩れます。
    • タグは角括弧の中に書き、表示されるテキストは開きタグと閉じタグの間に書きます。
    • 見出しは <h1> (最大)から <h6> まであります。サイズだけで見出しを選択しないでください。
  • 2 Lists, links & images · ⁨リスト、リンク、画像⁩
    2.1

    リスト

    English

    An unordered list 无序列表 <ul> shows bullets; an ordered list 有序列表 <ol> shows numbers. Each list item 列表项 is an <li>.

    日本語

    无序リスト <ul> は項目記号を表示し、有序リスト <ol> は番号を表示します。各リストアイテムは ⟨li⟩ (<li>) です。

    <ul>
      <li>Apples</li>
      <li>Oranges</li>
    </ul>
    <ol>
      <li>Wake up</li>
      <li>Go to school</li>
    </ol>
    

    ul for bullets, ol for numbers; each item is li ul for bullets, ol for numbers; each item is li → ul はbullet、ol は数字用;各アイテムは li

    2.2

    リンク

    English

    A link 链接 is an anchor <a>. Its href attribute 属性 holds the address it points to.

    • Add target="_blank" to open the link in a new tab.
    日本語

    リンクはアンカー ⟨a⟩ (<a>) です。その href 属性に指し示すアドレスが格納されます。

    <a href="https://example.com">Visit Example</a>
    <br>
    <a href="page2.html">Go to the next page</a>
    
    • 新たなタブでリンクを開くには target="_blank" を追加します。
    2.3

    画像

    English

    An image 图片 is <img> — it has no closing tag. src is the picture's address; alt is text shown if the image cannot load (and read aloud to blind users).

    Common mistakes

    • An image needs src (the file) and alt (a description); a link needs href.
    • <img> has no separate closing tag.
    • A broken src path shows nothing — check the file name and folder.
    日本語

    画像は ⟨img⟩ (<img>) です。閉じタグはありません。src は画像のアドレスであり、alt は画像の読み込み失敗時に表示されるテキスト(視覚障害者向けスクリーンリーダーによる読み上げ用)です。

    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/Bitmap_VS_SVG.svg/120px-Bitmap_VS_SVG.svg.png"
         alt="bitmap versus vector" width="120">
    <p>If the picture is missing, the alt text shows instead.</p>
    

    ** 一般的なミス **

    • 画像には src(ファイル)と alt(説明文)が必要で、リンクには href が必要です。
    • <img> に独立した闭じタグはありません。
    • 破損した src パスは何も表示されません — ファイル名とフォルダを確認してください。
  • 3 Page structure · ⁨ページの構造⁩
    3.1

    A complete page

    English

    A real page has a fixed skeleton 骨架. <!DOCTYPE html> says it is HTML5. Everything sits inside <html>. The <head> holds information about the page; the <body> holds what you see.

    • The <title> shows in the browser tab.
    • <meta charset="utf-8"> lets the page show any language.
    日本語

    実際のページは固定された骨格を持ちます。 <!DOCTYPE html> はそれが HTML5 であることを示しています。すべての要素は <html> の中に配置されます。 <head> がページの情報を保持し、 <body> がユーザーが見る内容を持っています。

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>My Page</title>
      </head>
      <body>
        <h1>Welcome</h1>
        <p>This is a complete page.</p>
      </body>
    </html>
    

    A page is a tree: the head describes the page, the body holds what you see A page is a tree: the head describes the page, the body holds what you see → ページは木構造です:head はページを記述し、body は表示される内容を保持します

    • <title> はブラウザのタブに表示されます。
    • <meta charset="utf-8"> を使用することで、ページは任意の言語を表示できます。
    3.2

    Comments & nesting

    English

    A comment 注释 <!-- ... --> is a note the browser ignores. Tags nest 嵌套 inside one another; indent 缩进 each level so the structure stays clear. Close tags in the reverse order you opened them.

    Common mistakes

    • Tags must nest, not overlap: <b><i>text</i></b>, never <b><i>text</b></i>.
    • A page needs <html>, a <head> (for the title and links) and a <body> (for what you see).
    • A comment is <!-- ... -->; the browser ignores it.
    日本語

    コメント <!-- ... --> はブラウザが無視する注釈です。タグは互いにネストします。構造を明確に保つために、各レベルごとにインデントしてください。開いた順序と逆の順序で閉じるタグを記述します。

    <!-- a simple navigation bar -->
    <nav>
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
      </ul>
    </nav>
    

    ** 一般的なミス **

    • タグは重なり合うのではなくネストする必要があります:<b><i>text</i></b>、<b><i>text</b></i> ではありません。
    • ページには <html> 、タイトルやリンク用の <head> 、そしてユーザーが見るための <body> が必要です。
    • コメントは <!-- ... --> です;ブラウザはそれを無視します。
  • 4 Tables & forms · ⁨テーブルとフォーム⁩
    4.1

    テーブル

    English

    A table 表格 <table> is built from rows <tr>. A header cell 单元格 is <th> (bold, centred); a normal data cell is <td>.

    日本語

    テーブル <table> は行 <tr> から構成されます。ヘッダーセルは <th> (太字、中央揃え)で、通常のデータセルは <td> です。

    <table border="1" cellpadding="6">
      <tr><th>Name</th><th>Score</th></tr>
      <tr><td>Mei</td><td>88</td></tr>
      <tr><td>Sam</td><td>71</td></tr>
    </table>
    

    table → tr rows → th/td cells table → tr rows → th/td cells → table → tr 行 → th/td セル

    4.2

    フォーム

    English

    A form 表单 <form> collects input from the user. An <input> is a box; a <label> names it; a <button> submits 提交 it.

    • Common <input> type values: text, number, email, password, checkbox.

    Common mistakes

    • Table cells go inside rows: a <tr> holds the <td> cells.
    • Every form input should have a matching <label> so it is clear and accessible.
    • A button inside a form submits it by default — set type="button" if you do not want that.
    日本語

    フォーム <form> はユーザーからの入力を受け取る。 <input> はボックスであり、 <label> が名付け、 <button> が送信を行う。

    <form>
      <label>Name: <input type="text"></label>
      <br><br>
      <label>Age: <input type="number"></label>
      <br><br>
      <button type="submit">Send</button>
    </form>
    
    • 一般的な <input> type の値: text , number , email , password , checkbox 。

    ** 一般的なミス **

    • テーブルセルは行の中に配置される: <tr> が <td> セルを保持する。
    • 各フォーム入力は対応する <label> を持つべきであり、明確でアクセシブルにする。
    • フォーム内のボタンはデフォルトで送信しますが、そうしたくない場合は type="button" を設定します。
  • 5 Boxes & sections · ⁨ボックスとセクション⁩
    5.1

    div, span & セマンティックセクション

    English

    A <div> is a generic block 块级 box that groups content on its own lines. A <span> is a generic inline 行内 box inside a line of text. You use them to group things so you can style or position them.

    Semantic 语义 tags describe their role, which helps screen readers and search engines. Prefer them over plain <div> where they fit: <header>, <nav>, <main>, <section>, <article>, <footer>.

    Common mistakes

    • <div> is a block (starts a new line); <span> is inline (stays in the text).
    • Use semantic tags like <header>, <nav> and <footer> where they fit, not <div> for everything.
    • Do not use a tag just for its default look — style it with CSS instead.
    日本語

    <div> はコンテンツを各行にまとめるための一般的なブロックボックスです。<span> はテキストの行内にある一般的なインラインボックスです。これらはスタイリングや配置のためにグループ化するために使用します。

    <div>
      <span>Price:</span> <span>$9.99</span>
    </div>
    <div>
      <span>Stock:</span> <span>in stock</span>
    </div>
    

    セマンティックタグは役割を説明するため、スクリーンリーダーや検索エンジンに役立ちます。適宜 plain <div> よりもそれらを優先してください:<header>, <nav>, <main>, <section>, <article>, <footer>。

    <header><h1>My Site</h1></header>
    <main>
      <section>
        <h2>News</h2>
        <p>Today we launched the site.</p>
      </section>
    </main>
    <footer>© 2026 My Site</footer>
    

    ** 一般的なミス **

    • <div> はブロック(新しい行を開始)です;<span> はインライン(テキスト内に留まる)です。
    • <header>、<nav>、<footer> などの意味のあるタグを使用し、全てに <div> を使うのは避ける。
    • デフォルトの外観だけのためにタグを使用せず、代わりに CSS でスタイリングしてください。
    div is a block box; span wraps inline text
    div is a block box; span wraps inline text
  • 6 CSS basics · ⁨CSSの基礎⁩
    6.1

    CSS の追加

    English

    CSS 层叠样式表 styles HTML. The simplest way is a <style> block in the <head> (a bigger site uses a separate .css file with <link>). A CSS rule 规则 has a selector 选择器, then { property: value; } pairs called declarations 声明.

    日本語

    CSSがHTMLにスタイルを適用する。最も単純な方法は、 <style> ブロックを <head> (大規模サイトでは別 .css ファイルに <link> )に配置することだ。CSSルールにはセレクターがあり、その後に declarations と呼ばれる { property: value; } のペアが続く。

    <style>
      p  { color: blue; font-size: 18px; }
      h1 { color: darkred; }
    </style>
    <h1>Styled heading</h1>
    <p>This paragraph is blue.</p>
    
    Link a stylesheet so CSS rules style HTML elements
    Link a stylesheet so CSS rules style HTML elements
    6.2

    セレクタ: class & id

    English

    A class 类 styles many elements: add class="..." in HTML and write .name in CSS. An id 标识符 styles ONE element: id="..." and #name.

    The selectors you will meet most, in one place:

    Selector Chooses
    p every <p> element
    .note everything with class="note"
    #title the one element with id="title"
    h1, h2 several selectors at once
    nav a every <a> inside a <nav>
    .btn:hover one state of an element (see topic 10)

    Common mistakes

    • A class selector starts with . and an id selector with #.
    • Link the stylesheet in the <head>, or put rules inside a <style> block.
    • A class can be reused on many elements; an id should appear once per page.
    日本語

    class は複数の要素にスタイルを適用します:HTML に class="..." を追加し、CSS で .name を記述します。id は ONE (1つの) 要素にのみスタイルを適用します:id="..." と #name。

    <style>
      .note  { color: green; }
      #title { font-size: 24px; }
    </style>
    <h1 id="title">Welcome</h1>
    <p class="note">First note.</p>
    <p class="note">Second note.</p>
    

    最も頻繁に出会うセレクタを一处にまとめました:

    セレクタ 選択する対象
    p 全ての <p> 要素
    .note class="note" を持つ全ての内容
    #title id="title" を持つ1つの要素
    h1, h2 複数のセレクタを一度に
    nav a <a> 内のすべての <nav>
    .btn:hover 要素の状態の1つ(トピック 10 を参照)

    ** 一般的なミス **

    • クラスセレクタは . で始まり、IDセレクタは # で始まります。
    • スタイルシートを <head> にリンクするか、ルールを <style> ブロック内に置きます。
    • クラスは多くの要素で再利用可能ですが、id はページ内で一度のみ使用します。
  • 7 Colours & text · ⁨色とテキスト⁩
    7.1

    カラースタイルと背景

    English

    Set the text colour with color and the background 背景 with background-color. A colour can be a name (red), a hex 十六进制 code (#ff0000), or rgb(255, 0, 0).

    日本語

    文字色を color で、背景を background-color で設定します。色は名前一例 red 、ヘックスコード #ff0000 、または rgb(255, 0, 0) で指定できます。

    <style>
      body { background-color: #f0f4ff; }
      .card { background-color: white; color: #1e3a8a; padding: 12px; }
    </style>
    <div class="card">A card with its own colours.</div>
    
    CSS colours: named, hex, and rgb()
    CSS colours: named, hex, and rgb()
    7.2

    テキストのスタイリング

    English

    Common text properties: font-size, font-weight (e.g. bold), font-family 字体, text-align 对齐 (left / center / right), and line-height for spacing.

    Common mistakes

    • color sets the text colour; background-color sets the background.
    • A colour can be a name, a #rrggbb hex code, or rgb(...).
    • End each declaration inside the braces with a semicolon ; — it separates the property: value pairs (the one after the last declaration is optional). The rule itself ends with the closing brace }.
    日本語

    一般的なテキストプロパティ:font-size, font-weight (例:bold), font-family, text-align (left / center / right)、および spacing (間隔) 用の line-height。

    <style>
      h1 { font-family: Arial, sans-serif; text-align: center; }
      p  { font-size: 18px; line-height: 1.6; }
    </style>
    <h1>Centered title</h1>
    <p>Readable paragraph text with comfortable line spacing.</p>
    

    ** 一般的なミス **

    • color は文字色を設定し;background-color は背景を設定します。
    • 色は名前、#rrggbb ヘックスコード、または rgb(...) で指定できます。
    • 各 declaration は波括弧内を半角セミコロン ; で終了させます — これは property: value ペアを区切ります(最後の declaration の後のものは任意です)。ルール自体は閉じ波括弧 } で終わります。
  • 8 The box model · ⁨ボックスモデル⁩
    8.1

    ボックスモデル

    English

    Every element is a box with four layers, from inside out: the content 内容, the padding 内边距 (space inside the border), the border 边框, and the margin 外边距 (space outside the border).

    日本語

    すべての要素は内側から外側へ、content (コンテンツ)、padding (ボーダー内部のスペース)、border (枠線)、margin (ボーダー外部のスペース) という4つのレイヤーを持つボックスです。

    <style>
      .box { background: #dbeafe; border: 3px solid #2563eb;
             padding: 16px; margin: 20px; }
    </style>
    <div class="box">content + padding + border + margin</div>
    
    ボックスモデル:コンテンツ、パディング、ボーダー、マージンの順
    ボックスモデル:コンテンツ、パディング、ボーダー、マージンの順
    8.2

    マージン & パディング

    English

    padding adds space inside the border, pushing the content inwards. margin adds space outside, pushing other boxes away. Give one value for all sides, or four (top right bottom left).

    日本語

    padding はボーダー内側にスペースを追加してコンテンツを内側に押し込みます。margin は外側にスペースを追加して他のボックスを遠ざけます。1つの値を全辺に与えるか、4つ (上 右 下 左) を与えます。

    <style>
      .a { background: #fde68a; padding: 4px; }
      .b { background: #bbf7d0; padding: 20px; margin-top: 16px; }
    </style>
    <div class="a">tight padding</div>
    <div class="b">roomy padding</div>
    
    8.3

    ディスプレイ

    English

    The display property sets how a box flows. block 块级 takes a whole line; inline 行内 sits within a line of text; none removes the box completely; flex lays the children in a row (next topic).

    Common mistakes

    • Padding is inside the border; margin is the space outside it.
    • box-sizing: border-box makes the set width include padding and border — often what you want.
    • display: none hides an element completely; visibility: hidden leaves its space.
    日本語

    display プロパティはボックスのフロー方法を設定します。block は全体を占める行を消費します;inline はテキストの行内に配置されます;none はボックスを完全に非表示にします;flex は子要素を横一列に並べます(次トピック)。

    <style>
      .hidden { display: none; }
      .chip { display: inline; background: #e0e7ff; padding: 2px 8px; border-radius: 6px; }
    </style>
    <p>Visible text. <span class="hidden">(secret)</span> <span class="chip">a chip</span></p>
    

    ** 一般的なミス **

    • パディングはボーダーの内側にあり、マージンはその外側のスペースです。
    • box-sizing: border-box は設定された幅に padding と border を含めます — 通常これが望ましいものです。
    • display: none は要素を完全に隠し;visibility: hidden はそのスペースを残します。
  • 9 Layout · ⁨レイアウト⁩
    9.1

    幅 & 中央揃え

    English

    Set a box's width. To centre 居中 a block, give it a width and margin: 0 auto — auto shares the leftover space equally on the left and right.

    日本語

    ボックスの width を設定します。ブロックを中央に配置するには、width を与えて margin: 0 auto にします — auto は残りのスペースを左右均等に分配します。

    <style>
      .page { width: 300px; margin: 0 auto; background: #e0e7ff;
              padding: 16px; text-align: center; }
    </style>
    <div class="page">A centered, fixed-width page.</div>
    
    9.2

    フレックスボックス

    English

    Flexbox 弹性布局 lays children out in a row (or a column). Set display: flex on the parent — the container 容器. gap adds space between children; flex: 1 makes them share the width.

    日本語

    Flexbox は子要素を横一列 (または縦一列) に並べます。親要素であるコンテナに display: flex を設定します。gap は子要素間にスペースを追加し;flex: 1 は幅を共有します。

    <style>
      .row { display: flex; gap: 10px; }
      .row div { background: #93c5fd; padding: 12px; flex: 1; text-align: center; }
    </style>
    <div class="row">
      <div>One</div>
      <div>Two</div>
      <div>Three</div>
    </div>
    
    フレックスコンテナはメイン軸に沿ってアイテムを配置し、gap が間にスペースを追加します
    フレックスコンテナはメイン軸に沿ってアイテムを配置し、gap が間にスペースを追加します
    9.3

    ミニプロジェクト:プロフィールカード

    English

    Combine boxes, colours, text and spacing into one small component 组件.

    Common mistakes

    • Centre a block with a set width using margin: 0 auto.
    • Flexbox needs display: flex on the CONTAINER, not on the items.
    • A width in % is relative to the parent, so check the parent's width too.
    日本語

    ボックス、カラー、テキスト、スペースを一つの小さなコンポーネントに組み合わせます。

    <style>
      .card { width: 240px; margin: 0 auto; border: 1px solid #cbd5e1;
              border-radius: 12px; padding: 16px; font-family: sans-serif; }
      .card h2 { margin: 0; color: #1e3a8a; }
      .card .role { color: #64748b; margin: 4px 0 8px; }
    </style>
    <div class="card">
      <h2>Mei Chen</h2>
      <p class="role">Student · Grade 11</p>
      <p>Loves maths and building web pages.</p>
    </div>
    

    ** 一般的なミス **

    • 固定された幅を持つブロックをmargin: 0 autoで中央に配置します。
    • Flexbox は ITEMS (アイテム) ではなく CONTAINER (コンテナ) に display: flex が必要です。
    • % 内の幅は親に対する相対的なため、親の幅も確認してください。
  • 10 Going further · ⁨さらに進んで⁩
    10.1

    ホバー & 擬似クラス

    English

    A pseudo-class 伪类 styles an element in one particular state. :hover applies while the mouse is over the element. Add transition 过渡 so the change happens smoothly instead of jumping.

    • Other useful pseudo-classes: :focus (an input the user clicked into) and :first-child.
    日本語

    擬似クラスは特定の状態にある要素にスタイルを適用します。:hover はマウスが要素の上にある間適用されます。transition を追加すると、変換が跳ねるのではなく滑らかに行われます。

    <style>
      .btn { background: #2563eb; color: white; padding: 10px 18px;
             border: none; border-radius: 8px; font-size: 16px;
             transition: background 0.3s; }
      .btn:hover { background: #16a34a; }
    </style>
    <button class="btn">Hover me</button>
    
    • 他の便利な擬似クラス::focus (ユーザーが入力 field に焦点を当てたもの) と :first-child。
    :hover はポインタが要素の上にある間、そのスタイルを指定します
    :hover はポインタが要素の上にある間、そのスタイルを指定します
    10.2

    ポジショニング

    English

    Positioning 定位 moves a box away from its normal place. relative nudges the box (and makes it the anchor 锚点 for its children); absolute places a box exactly, measured from the nearest positioned parent; fixed pins it to the screen even when the page scrolls.

    • top, right, bottom, left say how far to move — they only work on positioned boxes.
    日本語

    ポジショニングはボックスを通常の位置からずらします。relative はボックスを少しずらし (そしてそれを子要素のためのアンカーにします);absolute は最も近い positioned 親から測定して正確に配置します;fixed はページがスクロールしても画面に固定します。

    <style>
      .card { position: relative; width: 260px; height: 90px;
              background: #dbeafe; border-radius: 10px; padding: 12px; }
      .badge { position: absolute; top: -10px; right: -10px;
               background: #dc2626; color: white; padding: 4px 10px;
               border-radius: 999px; font-size: 13px; }
    </style>
    <div class="card">
      A product card
      <span class="badge">NEW</span>
    </div>
    
    • top, right, bottom, left は移動量を指定しますが、positioned ボックスでのみ機能します。
    10.3

    メディアクエリ & レスポンシブデザイン

    English

    A responsive 响应式 page adapts to the screen size. A media query 媒体查询 applies its rules only while a condition about the screen holds, such as max-width.

    • Design mobile-first 移动优先: write the phone styles first, then add @media (min-width: ...) rules for bigger screens.
    • Percent widths and max-width let boxes shrink with the screen.

    Common mistakes

    • :hover sticks to its selector with no space: .btn:hover, not .btn :hover.
    • position: absolute is measured from the nearest positioned parent — give that parent position: relative.
    • A media query wraps whole rules: @media (max-width: 600px) { .a { ... } }.
    日本語

    レスポンシブページは画面サイズに合わせて適応します。メディアクエリは条件 (例えば max-width など) が成立している間のみルールを適用します。

    <style>
      .banner { background: #2563eb; color: white; padding: 16px; }
      @media (max-width: 600px) {
        .banner { background: #16a34a; }   /* narrow screens turn green */
      }
    </style>
    <div class="banner">Resize the window: blue when wide, green when narrow.</div>
    
    • Mobile-first で設計します:まずスマホ用スタイルを書き、次に大きい画面用の @media (min-width: ...) ルールを追加します。
    • パーセント幅と max-width はボックスを画面に合わせて縮小できます。

    ** 一般的なミス **

    • :hoverは選択子とスペースなしで接続する: .btn:hover、 .btn :hoverではない。
    • position: absoluteは最も近い配置された親要素から測定される — その親に position: relative を与える。
    • メディアクエリは全体のルールをラップする: @media (max-width: 600px) { .a { ... } }。

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP