Heim  >  Artikel  >  Web-Frontend  >  Wie verwende ich das -Tag in HTML für die Formatierung von Tastatureingaben?

Wie verwende ich das -Tag in HTML für die Formatierung von Tastatureingaben?

PHPz
PHPznach vorne
2023-08-20 11:45:381196Durchsuche

Wie verwende ich das <kbd>-Tag in HTML für die Formatierung von Tastatureingaben?

Wir verwenden das -Tag, um Tastatureingaben zu definieren. Der darin enthaltene Inhalt wird von den meisten Browsern in der Standard-Monospace-Schriftart angezeigt die Schriftart mithilfe eines Stylesheets.

Syntax

<kbd> Keyboard text…

Beispiel 1

Es folgt das Beispiel mit dem -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>
Die chinesische Übersetzung von

Beispiel 2

lautet:

Beispiel 2

Dieses Tag kann in HTML-Dokumenten wie unten gezeigt verwendet werden −

<html>
   <body>
      <p>Two special keys in keyboard are:<kbd>ctrl</kbd>, <kbd>alt</kbd>.</p>
   </body>
</html>

Beispiel 3

Wir können auch Stile für Tastaturwerte in HTML-Dokumenten hinzufügen.

<!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>

Das obige ist der detaillierte Inhalt vonWie verwende ich das -Tag in HTML für die Formatierung von Tastatureingaben?. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:tutorialspoint.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen