we use 5e4e803d53d659f332070b5d4aa430db 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 1following 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 的中文翻译为:示例2这个标签可以在html文档中使用,如下所示 −
<html> <body> <p>two special keys in keyboard are:<kbd>ctrl</kbd>, <kbd>alt</kbd>.</p> </body></html>
example 3我们还可以在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> <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>
以上就是如何在html中使用<kbd>标签进行键盘输入格式化?的详细内容。
