--- id: html-computercode title: "HTML Computercode" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["computer code elements", "kbd element", "samp element", "code element", "var element", "pre element", "keyboard input"] 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", "w3schools", "code", "semantic"] raw_sources: ["https://www.w3schools.com/html/html_computercode_elements.asp"] applied_in: [] github_commit: "" --- # [[HTML Computercode]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) HTML provides several semantic elements for marking up user input and computer code β€” ``, ``, ``, ``, and `
` β€” most of which render in the browser's default monospace font. [S1]

## 🧠 핡심 κ°œλ… (Core concepts)
- **``** β€” defines keyboard input; content is displayed in the browser's default monospace font. [S1]
- **``** β€” defines sample output from a computer program; displayed in monospace. [S1]
- **``** β€” defines a piece of computer code; displayed in monospace, but does NOT preserve extra whitespace and line-breaks. [S1]
- **``** β€” defines a variable in programming or in a mathematical expression; typically displayed in italic. [S1]
- **`
`** β€” defines preformatted text; wrapping `` in `
` preserves whitespace and line-breaks. [S1]

## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns)
- **Keyboard shortcut markup** β€” `Ctrl + S`. [S1]
- **Program output markup** β€” `...` (with `
` for line breaks). [S1] - **Inline code** β€” `...` (whitespace collapses). [S1] - **Preserved code block** β€” `
...
` to keep whitespace and line-breaks. [S1] - **Variable markup** β€” `b`, `h` for math/programming variables. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) HTML contains several elements for defining user input and computer code. [S1] **HTML `` for keyboard input** The HTML `` element is used to define keyboard input. The content inside is displayed in the browser's default monospace font. [S1] ```html

Save the document by pressing Ctrl + S

``` **HTML `` for program output** The HTML `` element is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font. [S1] ```html

Message from my computer:

File not found.
Press F1 to continue

``` **HTML `` for computer code** The HTML `` element is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font. [S1] ```html x = 5; y = 6; z = x + y; ``` Notice that the `` element does NOT preserve extra whitespace and line-breaks. [S1] **Preserve line-breaks** To preserve extra whitespace and line-breaks, you can put the `` element inside a `
` element: [S1]
```html

x = 5;
y = 6;
z = x + y;

``` **HTML `` for variables** The HTML `` element is used to define a variable in programming or in a mathematical expression. The content inside is typically displayed in italic. [S1] ```html

The area of a triangle is: 1/2 x b x h, where b is the base, and h is the vertical height.

``` **Chapter summary** - `` defines keyboard input - `` defines sample output from a computer program - `` defines a piece of computer code - `` defines a variable in programming or in a mathematical expression - `
` defines preformatted text

[S1]

**HTML computer code elements reference**

| Tag | Description |
|---|---|
| `` | Defines programming code |
| `` | Defines keyboard input |
| `` | Defines computer output |
| `` | Defines a variable |
| `
` | Defines preformatted text |

[S1]

## πŸ› οΈ 적용 사둀 (Applied in summary)
The per-element snippets above (keyboard shortcut, program message, code block, preserved code block, variable in a formula) are the canonical applied examples. No external project/commit applications found in the source.

## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns)
Keyboard input:
```html
Ctrl + S
```
Program output:
```html
File not found.
Press F1 to continue
``` Whitespace-preserving code block: ```html

x = 5;
y = 6;
z = x + y;
``` Variable: ```html b ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **`` alone** β€” monospace, but collapses extra whitespace and line-breaks; use for inline/short code. [S1] - **`` inside `
`** β€” preserves whitespace and line-breaks; use for multi-line code blocks. [S1]

## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates)
No contradictions found in the source.

## βœ… 검증 μƒνƒœ 및 신뒰도
- **μƒνƒœ:** draft
- **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯)
- **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body)
- **μ‹ λ’° 점수:** 0.90
- **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery)

## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph)
- **μƒμœ„/루트:** [[HTML Tutorial]]
- **κ΄€λ ¨ κ°œλ…:** [[HTML Semantics]], [[HTML Formatting]], [[HTML Introduction]], [[HTML Style Guide]]
- **μ°Έμ‘° λ§₯락:** Referenced when documenting code, keyboard shortcuts, program output, or variables within HTML content.

## πŸ“š 좜처 (Sources)
- [S1] W3Schools β€” HTML Computercode β€” https://www.w3schools.com/html/html_computercode_elements.asp

## πŸ“ λ³€κ²½ 이λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "HTML Computercode" page (Astra wiki-curation, P-Reinforce v3.1 format).