HTML kbd Tag

The HTML <kbd> tag is used to define the text that represents the user keyboard input, voice input, or any text entry device. The browser renders the text in monospace font.

Syntax

<kbd>keyboard input</kbd>

Example

<!doctype html>
<html>
   <head>
      <title>HTML kbd Tag</title>
   </head>
   <body>
      <h1>HTML kbd Tag Examples</h1>
      <p>Press <kbd>Ctrl</kbd>+<kbd>D</kbd> to Bookmark this page.</p>
   </body>
</html>

Output:

HTML kbd Tag

Global Attributes

The <kbd> tag supports all the Global Attributes in HTML.

Event Attributes

The <kbd> tag supports all the Event Attributes in HTML.

Supported Browsers

Element Chrome Firefox IE Opera Safari
<kbd> Yes Yes Yes Yes Yes

Examples

<!doctype html>
<html>
   <head>
      <title>HTML kbd Tag</title>
   </head>
   <style>
      kbd{
          border:2px solid #666;
          padding:2px;
          border-radius:3px;
          background: #d6d6d6;
      }
   </style>
   <body>
      <h1>HTML kbd Tag Examples</h1>
      <p>Press <kbd>Ctrl</kbd> + <kbd>D</kbd> to Bookmark this page.</p>
   </body>
</html>

Output:

html kbd tag with style

Leave a Comment

Your email address will not be published.