DEV Community

Cover image for HTML tags | kbd
Carlos Espada
Carlos Espada

Posted on

HTML tags | kbd

It is used to represent the input of text by the user through a keyboard, by voice or using any other similar device.

It can be used in combination with the <samp> tag to represent various forms of text input and output:

  • Nest a <kbd> inside another <kbd>
<p>You can also create a new document using the keyboard shortcut <kbd><kbd>Ctrl</kbd> + <kbd>N</kbd></kbd>.</p>
Enter fullscreen mode Exit fullscreen mode
  • Nest a <kbd> inside a <samp>
<p>If a syntax error occurs, the tool will output the initial command you typed for your review:</p>
<blockquote>
  <samp><kbd>custom-git ad my-new-file.cpp</kbd></samp>
</blockquote>
Enter fullscreen mode Exit fullscreen mode
  • Nest a <samp> inside a <kbd>
<p>To create a new file, choose the menu option <kbd><kbd><samp>File</samp></kbd>⇒<kbd><samp>New Document</samp></kbd></kbd></p>
<p>Don't forget to click the <kbd><samp>OK</samp></kbd> button to confirm once you've entered the name of the new file.</p>
Enter fullscreen mode Exit fullscreen mode

Normally browsers render them using their default monospaced font, although you can customize the style using CSS.

  • Type: inline
  • Self-closing: No
  • Semantic value: No

Definition | Example | Support

Discussion (0)