docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더). - Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외) - Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체) - Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속) 각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
---
|
||||
id: html-form-elements
|
||||
title: "HTML Form Elements"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["form elements", "select element", "textarea", "fieldset", "datalist", "output element", "button element", "optgroup"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.90
|
||||
created_at: 2026-06-23
|
||||
updated_at: 2026-06-23
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["html", "web", "frontend", "forms", "elements", "w3schools"]
|
||||
raw_sources: ["https://www.w3schools.com/html/html_form_elements.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[HTML Form Elements]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
Beyond `<input>`, the HTML `<form>` can contain a family of dedicated controls — `<label>`, `<select>`/`<option>`, `<textarea>`, `<button>`, `<fieldset>`/`<legend>`, `<datalist>`, and `<output>` — each serving a specific input or grouping role. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **A form's element family** — `<input>`, `<label>`, `<select>`, `<textarea>`, `<button>`, `<fieldset>`, `<legend>`, `<datalist>`, `<output>`, `<option>`, `<optgroup>`. [S1]
|
||||
- **`<select>` = drop-down** — built from `<option>` children; `selected` pre-selects, `size` shows multiple rows, `multiple` allows multiple selections. [S1]
|
||||
- **`<textarea>` = multi-line text** — sized with `rows`/`cols` or with CSS. [S1]
|
||||
- **`<fieldset>`/`<legend>`** — group related controls with a caption. [S1]
|
||||
- **`<datalist>`** — supplies a predefined option list for an `<input>`; **`<output>`** displays a calculation result. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Drop-down pattern** — `<select>` wrapping `<option value="...">` entries. [S1]
|
||||
- **Pre-select / multi-select** — `selected` on an option; `size="n"` and `multiple` on the select. [S1]
|
||||
- **Grouping pattern** — `<fieldset><legend>Caption</legend> … </fieldset>`. [S1]
|
||||
- **Autocomplete-list pattern** — `<input list="id">` + `<datalist id="id">`. [S1]
|
||||
- **Live calculation pattern** — `<form oninput="...">` + `<output for="a b">`. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
The HTML `<form>` element can contain one or more of these elements: `<input>`, `<label>`, `<select>`, `<textarea>`, `<button>`, `<fieldset>`, `<legend>`, `<datalist>`, `<output>`, `<option>`, `<optgroup>`. [S1]
|
||||
|
||||
**The `<input>` Element**
|
||||
One of the most used form elements; displayed in many ways depending on its `type` attribute. [S1]
|
||||
```html
|
||||
<label for="fname">First name:</label>
|
||||
<input type="text" id="fname" name="fname">
|
||||
```
|
||||
|
||||
**The `<label>` Element**
|
||||
Defines a label for form elements. It helps screen-reader users, and gives a larger click target for checkboxes and radio buttons. The `for` attribute should match the related `<input>` element's `id`. [S1]
|
||||
|
||||
**The `<select>` Element**
|
||||
Defines a drop-down list, built from `<option>` elements. [S1]
|
||||
```html
|
||||
<label for="cars">Choose a car:</label>
|
||||
<select id="cars" name="cars">
|
||||
<option value="volvo">Volvo</option>
|
||||
<option value="saab">Saab</option>
|
||||
<option value="fiat">Fiat</option>
|
||||
<option value="audi">Audi</option>
|
||||
</select>
|
||||
```
|
||||
Pre-select an option with `selected`: [S1]
|
||||
```html
|
||||
<option value="fiat" selected>Fiat</option>
|
||||
```
|
||||
Show a number of visible values with `size`: [S1]
|
||||
```html
|
||||
<select id="cars" name="cars" size="3">
|
||||
...
|
||||
</select>
|
||||
```
|
||||
Allow multiple selections with `multiple`: [S1]
|
||||
```html
|
||||
<select id="cars" name="cars" size="4" multiple>
|
||||
...
|
||||
</select>
|
||||
```
|
||||
|
||||
**The `<textarea>` Element**
|
||||
Defines a multi-line input field, sized with `rows` and `cols`: [S1]
|
||||
```html
|
||||
<textarea name="message" rows="10" cols="30">
|
||||
The cat was playing in the garden.
|
||||
</textarea>
|
||||
```
|
||||
Size can also be defined with CSS: [S1]
|
||||
```html
|
||||
<textarea name="message" style="width:200px; height:600px;">
|
||||
The cat was playing in the garden.
|
||||
</textarea>
|
||||
```
|
||||
|
||||
**The `<button>` Element**
|
||||
Defines a clickable button. Always specify the `type` attribute for a button. [S1]
|
||||
```html
|
||||
<button type="button" onclick="alert('Hello World!')">Click Me!</button>
|
||||
```
|
||||
|
||||
**The `<fieldset>` and `<legend>` Elements**
|
||||
`<fieldset>` groups related data in a form; `<legend>` defines a caption for the `<fieldset>`. [S1]
|
||||
```html
|
||||
<form action="/action_page.php">
|
||||
<fieldset>
|
||||
<legend>Personalia:</legend>
|
||||
<label for="fname">First name:</label><br>
|
||||
<input type="text" id="fname" name="fname" value="John"><br>
|
||||
<label for="lname">Last name:</label><br>
|
||||
<input type="text" id="lname" name="lname" value="Doe"><br><br>
|
||||
<input type="submit" value="Submit">
|
||||
</fieldset>
|
||||
</form>
|
||||
```
|
||||
|
||||
**The `<datalist>` Element**
|
||||
Specifies a list of pre-defined options for an `<input>` element. Users see a drop-down list of the predefined options as they enter data. The input's `list` attribute must match the datalist's `id`. [S1]
|
||||
```html
|
||||
<form action="/action_page.php">
|
||||
<input list="browsers">
|
||||
<datalist id="browsers">
|
||||
<option value="Edge">
|
||||
<option value="Firefox">
|
||||
<option value="Chrome">
|
||||
<option value="Opera">
|
||||
<option value="Safari">
|
||||
</datalist>
|
||||
</form>
|
||||
```
|
||||
|
||||
**The `<output>` Element**
|
||||
Represents the result of a calculation (typically performed by a script). [S1]
|
||||
```html
|
||||
<form action="/action_page.php"
|
||||
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
|
||||
0
|
||||
<input type="range" id="a" name="a" value="50">
|
||||
100 +
|
||||
<input type="number" id="b" name="b" value="50">
|
||||
=
|
||||
<output name="x" for="a b"></output>
|
||||
<br><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
```
|
||||
|
||||
**HTML Form Elements (summary)** [S1]
|
||||
|
||||
| Tag | Description |
|
||||
|---|---|
|
||||
| `<form>` | Defines an HTML form for user input |
|
||||
| `<input>` | Defines an input control |
|
||||
| `<textarea>` | Defines a multiline input control (text area) |
|
||||
| `<label>` | Defines a label for an `<input>` element |
|
||||
| `<fieldset>` | Groups related elements in a form |
|
||||
| `<legend>` | Defines a caption for a `<fieldset>` element |
|
||||
| `<select>` | Defines a drop-down list |
|
||||
| `<optgroup>` | Defines a group of related options in a drop-down list |
|
||||
| `<option>` | Defines an option in a drop-down list |
|
||||
| `<button>` | Defines a clickable button |
|
||||
| `<datalist>` | Specifies a list of pre-defined options for input controls |
|
||||
| `<output>` | Defines the result of a calculation |
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The `<output>` live-calculation form above is the canonical applied case: a slider plus a number field whose sum is displayed in real time via `oninput`. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Drop-down with a pre-selected option (HTML):
|
||||
```html
|
||||
<select id="cars" name="cars">
|
||||
<option value="volvo">Volvo</option>
|
||||
<option value="fiat" selected>Fiat</option>
|
||||
</select>
|
||||
```
|
||||
Grouped fields with caption:
|
||||
```html
|
||||
<fieldset>
|
||||
<legend>Personalia:</legend>
|
||||
<input type="text" name="fname">
|
||||
</fieldset>
|
||||
```
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
No contradictions found in the source. [S1]
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.90
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[HTML Tutorial]]
|
||||
- **관련 개념:** [[HTML Forms]], [[HTML Form Attributes]], [[HTML Input Types]], [[HTML Input Attributes]]
|
||||
- **참조 맥락:** Referenced when choosing the right control (drop-down, text area, grouping, etc.) inside a form.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — HTML Form Elements — https://www.w3schools.com/html/html_form_elements.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "HTML Form Elements" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user