`, ``, 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).