Home >Web Front-end >HTML Tutorial >kbd Tag in HTML
The following article outlines the kbd tag in HTML. The tag in HTML helps to recognize text which is defined by the user’s keyboard input. It is used to take input from the keyboard. It is mainly used whenever there is a need to display text which the user enters through their keyboard. It comes under the category of the tag known as the phrase tag. This is also known as an inline element. The default font set to this tag is monospace from the font family. One can use different style codes to improve the text’s look and feel included within the tag. It always contains text which one can easily type through a keyboard.
The tag defined in the HTML within opening and closing tag.
The text enclosed within this tag as follows:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <p>Kbd tag in HTML < kbd> Text </kbd> <kbd> Text </kbd> <kbd> Text </kbd> </body> </html>
This tag is known as phrase tag, which includes font format in monospace type. One can change the styling of the text included within the tag using different CSS properties as follows:
For setting text layout style to the tag, there are different properties into the CSS are as follows:
tag is one of the most useful tags used in HTML for various purposes. The main use of tag into the user documentation. Because it helps to show the text which is going to be typed on the keyboard. It is a fantastic and helpful element in HTML. the tag also used to create keyboard shortcuts.
That will help create a new document, save the document, open it in a new tab, etc. It works on various CSS properties for styled output. Suppose we are going to create a keyboard shortcut using tag in HTML. Here we are copying some text and paste it.
So we will do this thing using tag through short cuts as follows: So this example will create a shortcut to copy text from ctrl +c and also paste it using ctrl + v. Given below are the examples of kbd Tag in HTML: Output: Output: Output: キーボードで Ctrl+Shift+T キーをクリックすると、ブラウザで以前に閉じたタブが再度開きます。 HTML の タグは、テキストをキーボード入力として表示するために使用されます。等幅フォントです。このタグは、font-family、font-weight、font-color、background-color、font-size、font-style、text-decoration、white-space、text- などのさまざまな CSS プロパティを使用してスタイル設定できます。 Break、text-shadow、text-align –last、text-letter-spacing、text-overflow など The above is the detailed content of kbd Tag in HTML. For more information, please follow other related articles on the PHP Chinese website!
ctrl + c and then ctrl + v Examples of kbd Tag in HTML
Example #1 – This is a simple example of the tag.
<!DOCTYPE html>
<html>
<head>
<title>kbd tag</title>
<style>
kbd.key {
padding: 3px 3px 0;
border-radius: 2px;
border: 1px solid #666;
border-color: blueviolet;}
</style>
</head>
<body>
<p>Copy some code using <kbd><kbd>Ctrl</kbd>+<kbd>c</kbd></kbd>.</p>
<p>Paste copied code using <kbd><kbd>Ctrl</kbd>+<kbd>v</kbd></kbd>.</p>
<p>Save all the details of the data using <kbd ><kbd class="key" >Ctrl</kbd>+
<kbd class="key">s</kbd></kbd>.</p>
<p>Create a new document by pressing <kbd><kbd class="key">Ctrl</kbd>+
<kbd class="key">N</kbd></kbd>.</p>
</body>
</html>
Example #2 – tag using CSS properties.
<!DOCTYPE html>
<html>
<head>
<title>kbd tag</title>
<style>
kbd.font {
font-style: italic;
font-size: 20px;
}
kbd.cursive{
font-family: cursive;
}
kbd.fantasy{
font-family:fantasy;
color:darkmagenta;
}
kbd.inherit{
font-family:inherit;
}
kbd.sans-serif{
font-family:sans-serif;
background-color: aquamarine;
}
kbd.weight{
font-weight:bold;
}
</style>
</head>
<body>
<h4>kbd tag uses Font style</h4>
<p><kbd class="font">The Whole world steps aside for the man who knows where he is going</kbd><hr>
<h4>kbd tag uses Font Family</h4>
<p><kbd class="cursive">People rarely succeed unless they have fun in what they are doing</kbd>
<p><kbd class="fantasy">People rarely succeed unless they have fun in what they are doing</kbd>
<p><kbd class=" inherit">People rarely succeed unless they have fun in what they are doing</kbd>
<p><kbd class="sans-serif">People rarely succeed unless they have fun in what they are doing</kbd>
<hr>
<h4>kbd tag uses Font weight </h4>
<p><kbd class="weight"> Only those who dare to fail greatly can ever achieve greatly</kbd>
<hr>
</body>
</html>
Example #3
<!DOCTYPE html>
<html>
<head>
<title>HTML kbd Tag</title>
</head>
<body>
<p>kbd tag to reopen previously closed tab by clicking
<br>
<br>
<kbd>ctrl</kbd>+
<kbd>shift</kbd>+
<kbd>t</kbd>
</body>
</html>
結論 – HTML の kbd タグ