- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use the tag for keyboard input formatting in HTML?
We use <kbd> tag to define keyboard input. It is a phrase tag that is used to identify text that represents user keyboard input. The content inside is displayed in the default monospace font by most browsers. We can override the font using style sheet.
Syntax
<kbd> Keyboard text…
Example 1
Following is the example using the <kbd> tag in HTML −
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="description" content="meta tag in the web document"> <meta name="keywords" content="HTML,CSS"> <meta name="author" content="lokesh"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p> Open a new file using the keyboard shortcut <kbd>Ctrl</kbd> + <kbd>N</kbd> </p> <p>Press<kbd>Ctrl </kbd> + <kdb>C </kdb>to copy text from the file.</p> <p>Press<kbd>Ctrl </kbd> + <kdb>P </kdb>to paste text to the file.</p> </body> </html>
Example 2
This tag can be used in html document as −
<html> <body> <p>Two special keys in keyboard are:<kbd>ctrl</kbd>, <kbd>alt</kbd>.</p> </body> </html>
Example 3
We can also add styling to the keyboard value in the HTML document.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="description" content="meta tag in the web document"> <meta name="keywords" content="HTML,CSS"> <meta name="author" content="lokesh"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> kbd { border-radius: 2px; padding: 2px; border: 1px solid black; } </style> </head> <body> <p> Open a new file using the keyboard shortcut <kbd>Ctrl</kbd> + <kbd>N</kbd> </p> <p>Press<kbd>Ctrl </kbd> + <kdb>C </kdb>to copy text from the file.</p> <p>Press<kbd>Ctrl </kbd> + <kdb>P </kdb>to paste text to the file.</p> </body> </html>
- Related Articles
- How to use the tag in HTML?
- How to use the tag in HTML?
- How to use the tag in HTML?
- How to use Emphasized formatting in HTML?
- How to use small formatting in HTML?
- How do we do variable formatting using the tag in HTML?
- How do we do computer output formatting using the tag in HTML?
- How to use the tag to define style information for an HTML page?
- How to use title tag in HTML Page?
- How to use the tag to define the base URL for an HTML page?
- How to use an HTML tag inside HTML table?
- How to use the tag to define HTML document title?
- How to use range input type in HTML?
- How to use month input type in HTML?
- How to use time input type in HTML?

Advertisements