Tag HTML <kbd>
Esempio
Definisci del testo come input da tastiera in un documento:
<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy text (Windows).</p>
<p>Press <kbd>Cmd</kbd> + <kbd>C</kbd> to copy text (Mac OS).</p>
Altri esempi "Provalo da solo" di seguito.
Definizione e utilizzo
Il <kbd>
tag viene utilizzato per definire l'input da tastiera. Il contenuto all'interno viene visualizzato nel carattere monospazio predefinito del browser.
Suggerimento: questo tag non è obsoleto. Tuttavia, è possibile ottenere un effetto più ricco utilizzando i CSS (vedi esempio sotto).
Guarda anche:
Tag | Description |
---|---|
<code> | Defines a piece of computer code |
<samp> | Defines sample output from a computer program |
<var> | Defines a variable |
<pre> | Defines preformatted text |
Supporto browser
Element | |||||
---|---|---|---|---|---|
<kbd> | Yes | Yes | Yes | Yes | Yes |
Attributi globali
Il <kbd>
tag supporta anche gli attributi globali in HTML .
Attributi dell'evento
Il <kbd>
tag supporta anche gli attributi dell'evento in HTML .
Altri esempi
Esempio
Usa CSS per definire lo stile dell'elemento <kbd>:
<html>
<head>
<style>
kbd {
border-radius: 2px;
padding: 2px;
border: 1px solid black;
}
</style>
</head>
<body>
<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy text
(Windows).</p>
<p>Press <kbd>Cmd</kbd> + <kbd>C</kbd> to copy text (Mac
OS).</p>
</body>
</html>
Pagine correlate
Tutorial HTML: formattazione del testo HTML
Riferimento HTML DOM: Oggetto Kbd
Impostazioni CSS predefinite
La maggior parte dei browser visualizzerà l' <kbd>
elemento con i seguenti valori predefiniti:
Esempio
kbd {
font-family: monospace;
}