HTML Java

HTML Computer Code Elements


HTML <kbd> For Keyboard Input

  • <kbd> represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device.
  • Text surrounded by <kbd> tags is typically displayed in a monospace font

Example

<html>
<body>
  <h2>The kbd Element</h2>
  <p>Print the document by pressing <kbd>Ctrl + P</kbd></p>
</body>
</html>
Try it »


HTML <samp> For Program Output

  • <samp> is used to enclose inline text which represents sample (or quoted) output from a computer program.
  • Its contents are typically rendered using the browser's default monospaced font.

Example

<html>
<body>
  <h2>The samp Element</h2>
  <p>If you input wrong value, the program will return <samp>Error!</samp></p>
</body>
</html>
Try it »


HTML <code> For Computer Code

  • The HTML <code> tag is used for indicating a piece of code. The code tag surrounds the code being marked up.
  • Browsers often display text surrounded by <code> tags in a monospaced font.

Example

<html>
<body>
  <h2>The code Element</h2>
  <p>Programming code example</p>
</body>
</html>
Try it »


HTML <var> For Variables

  • <var> represents the name of a variable in a mathematical expression or a programming context.
  • The <var> element is used to identify a variable.

Example

<html>
<body>
  <h2>The var Element</h2>
  <p>Area of Circle</p>
</body>
</html>
Try it »