Specialized Code Elements
1. <var> Element
Used to represent variables in mathematical expressions or programming contexts.
Code Example:
<!-- Mathematical variable -->
<p>The quadratic formula: <var>x</var> = (-<var>b</var> ± √(<var>b</var>² - 4<var>a</var><var>c</var>)) / (2<var>a</var>)</p>
<!-- Programming variable -->
<p>In the equation <var>y</var> = <var>mx</var> + <var>b</var>, <var>m</var> represents the slope.</p>
<!-- Code with variables -->
<p>Declare a variable: <code>let <var>userName</var> = "John";</code></p>
<!-- Multiple variables -->
<p>Swap variables: <code><var>a</var>, <var>b</var> = <var>b</var>, <var>a</var></code></p>
Output:
The quadratic formula: x = (-b ± √(b² - 4ac)) / (2a)
In the equation y = mx + b, m represents the slope.
Declare a variable: let userName = "John";
Swap variables: a, b = b, a
2. <kbd> Element
Used to represent keyboard input or keys that users should press.
Code Example:
<!-- Single key -->
<p>Press <kbd>Enter</kbd> to continue.</p>
<!-- Key combination -->
<p>Use <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy text.</p>
<!-- Multiple combinations -->
<p>Common shortcuts:
<kbd>Ctrl</kbd> + <kbd>S</kbd> to save,
<kbd>Ctrl</kbd> + <kbd>V</kbd> to paste,
<kbd>Ctrl</kbd> + <kbd>Z</kbd> to undo
</p>
<!-- Styled keyboard keys -->
<p>Press <kbd style="padding: 2px 6px; background: #333; color: white; border-radius: 3px;">F5</kbd> to refresh the page.</p>
Output:
Press Enter to continue.
Use Ctrl + C to copy text.
Common shortcuts:Ctrl + S to save,Ctrl + V to paste,Ctrl + Z to undo
Press F5 to refresh the page.
3. <samp> Element
Used to represent sample output from a computer program or system.
Code Example:
<!-- Program output -->
<p>The program output: <samp>Hello, World!</samp></p>
<!-- Command line output -->
<p>Terminal output:</p>
<pre><samp>
$ node script.js
Hello from Node.js!
Process completed successfully.
</samp></pre>
<!-- Error message -->
<p>Error message: <samp>Error: File not found</samp></p>
<!-- Multiple outputs -->
<p>Compilation results:</p>
<pre><samp>
Compiling project...
✓ 15 files processed
✓ 0 errors
✓ 2 warnings
Build successful!
</samp></pre>
Output:
The program output: Hello, World!
Terminal output:
$ node script.jsHello from Node.js!Process completed successfully.
Error message: Error: File not found