HTML Computer Code Elements
Example
<!DOCTYPE html>
<html>
<body>
<p>Some programming code:</p>
<code>
x = 5;<br>
y = 6;<br>
z = x + y;
</code>
</body>
</html>
Result
Some programming code:
Example
<!DOCTYPE html>
<html>
<body>
<p>The kbd element represents user input:</p>
<p>Save the document by pressing <kbd>Ctrl + S</kbd></p>
</body>
</html>
Result
The kbd element represents user input:
Save the document by pressing Ctrl + S
Example
<!DOCTYPE html>
<html>
<body>
<p>The samp element represents output from a program or computing system:</p>
<p>If you input wrong value, the program will return <samp>Error!</samp></p>
</body>
</html>
Result
The samp element represents output from a program or computing system:
If you input wrong value, the program will return Error!
Example
<!DOCTYPE html>
<html>
<body>
<p>Programming code example:</p>
<code>
x = 5;
y = 6;
z = x + y;
</code>
</body>
</html>
Result
Programming code example:
Example
<!DOCTYPE html>
<html>
<body>
<p>Einstein wrote: <var>E</var> = <var>mc</var><sup>2</sup>.</p>
</body>
</html>
Result
Einstein wrote: E = mc2.
Example
<!DOCTYPE html>
<html>
<body>
<p>Some programming code:</p>
<code>
x = 5;<br>
y = 6;<br>
z = x + y;
</code>
</body>
</html>
Some programming code:
x = 5;
y = 6;
z = x + y;
HTML <KBD> For Keyboard Input
The HTML <KBD> element represents user input, like keyboard input or voice commands.
Text surrounded by <kbd> tags is typically displayed in the browser's default monospace font:
<!DOCTYPE html>
<html>
<body>
<p>The kbd element represents user input:</p>
<p>Save the document by pressing <kbd>Ctrl + S</kbd></p>
</body>
</html>
The kbd element represents user input:
Save the document by pressing Ctrl + S
HTML <samp> For Program Output
The HTML <samp> element represents output from a program or computing system.
Text surrounded by <samp> tags is typically displayed in the browser's default monospace font:
<!DOCTYPE html>
<html>
<body>
<p>The samp element represents output from a program or computing system:</p>
<p>If you input wrong value, the program will return <samp>Error!</samp></p>
</body>
</html>
The samp element represents output from a program or computing system:
If you input wrong value, the program will return Error!
HTML <code> For Computer Code
The HTML <code> element defines a fragment of computer code.
Text surrounded by <code> tags is typically displayed in the browser's default monospace font:
<!DOCTYPE html>
<html>
<body>
<p>Programming code example:</p>
<code>
x = 5;
y = 6;
z = x + y;
</code>
</body>
</html>
Programming code example:
x = 5; y = 6; z = x + y;
HTML <var> For Variables
The HTML <var> element defines a variable.
The variable could be a variable in a mathematical expression or a variable in programming context:
<!DOCTYPE html>
<html>
<body>
<p>Einstein wrote: <var>E</var> = <var>mc</var><sup>2</sup>.</p>
</body>
</html>
Einstein wrote: E = mc2.
Comments
Post a Comment