Open In App

HTML <kbd> Tag

Last Updated : 19 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

It is a phrase tag and used to define the keyboard input. The text enclosed within <kbd> tag is typically display in the browser’s default monospace font.

Syntax:

<kbd> text content ... </kbd>

List of all phrase tag: 
 

  • <em>: It is used to emphasize the text.
  • <strong>: It is used to define an important text.
  • <code>: It encloses the computer code.
  • <samp>: It defines a sample output text from a computer program.
  • <kbd>: It defines the text of keyboard input.
  • <var>: It defines the variable text.

Example 1: This example describe the use of <kbd> tag.

html




<!DOCTYPE html>
<html>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h3>HTML kbd Tag</h3>
 
     
<p>
        Open a new window using the
        keyboard shortcut
        <kbd>Ctrl</kbd> + <kbd>N</kbd>
    </p>
 
</body>
 
</html>


Output: 
 

Example 2: This example using <kbd> tag with some CSS styles.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <style>
        kbd {
            border-radius: 2px;
            padding: 2px;
            border: 1px solid black;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>HTML kbd Tag</h2>
 
     
<p>Open a new window using the
        keyboard shortcut
        <kbd>Ctrl</kbd>+<kbd>N</kbd>
    </p>
 
</body>
 
</html>


Output:

Supported Browsers: 

  • Google Chrome
  • Edge 12 and above
  • Internet Explorer
  • Firefox 1 and above
  • Safari
  • Opera


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads