HTML <kbd> tagS2C Home   « HTML <kbd> tag

Definition

The <kbd> tag is used to define Keyboard Text.

Example


<p>Lets look at some Keyboard Text!!  <kbd>This text will be styled as Keyboard Text</kbd></p>

Lets look at some Keyboard Text!! This text will be styled as Keyboard Text

Attributes

The following attributes can be used with the <kbd> tag.


<kbd> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <kbd> tag.
<kbd> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<kbd class="name">Keyboard Text</kbd>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<kbd id="name">Keyboard Text</kbd>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<kbd style="color:red;">Keyboard Text</kbd>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<kbd title="Content info">Keyboard Text</kbd>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<kbd accesskey="a">Keyboard Text</kbd>
tabindexSpecifies a tab order for the element.

<kbd tabindex="1">Keyboard Text</kbd>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<kbd dir="ltr">Keyboard Text</kbd>
<!-- The text will flow from right to left -->
<kbd dir="rtl">Keyboard Text</kbd>
langSpecifies a language code for the content of the element.

<kbd lang="en">Keyboard Text</kbd>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<kbd spellcheck="true">Keyboard Text</kbd> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<kbd translate="no">Keyboard Text</kbd> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<kbd contenteditable="true">Keyboard Text</kbd> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<kbd draggable="true">Keyboard Text</kbd>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<kbd hidden>Keyboard Text</kbd> 
<kbd hidden="hidden">Keyboard Text</kbd> 
<kbd> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<kbd oncopy="go()">Keyboard Text</kbd> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<kbd oncut="go()">Keyboard Text</kbd>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<kbd onpaste="go()">Keyboard Text</kbd>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<kbd ondrag="go()">Keyboard Text</kbd>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<kbd ondragend="go()">Keyboard Text</kbd>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<kbd ondragenter="go()">Keyboard Text</kbd>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<kbd ondragleave="go()">Keyboard Text</kbd>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<kbd ondragover="go()">Keyboard Text</kbd>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<kbd ondragstart="go()">Keyboard Text</kbd>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<kbd ondrop="go()">Keyboard Text</kbd>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<kbd onblur="go()">Keyboard Text</kbd>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<kbd onchange="go()">Keyboard Text</kbd>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<kbd oncontextmenu="go()">Keyboard Text</kbd>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<kbd onfocus="go()">Keyboard Text</kbd>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<kbd oninput="go()">Keyboard Text</kbd>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<kbd oninvalid="go()">Keyboard Text</kbd>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<kbd onreset="go()">Keyboard Text</kbd>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<kbd onselect="go()">Keyboard Text</kbd>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<kbd onsubmit="go()">Keyboard Text</kbd>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<kbd onkeydown="go()">Keyboard Text</kbd>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<kbd onkeypress="go()">Keyboard Text</kbd>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<kbd onkeyup="go()">Keyboard Text</kbd>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<kbd onabort="go()">Keyboard Text</kbd>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<kbd oncanplay="go()">Keyboard Text</kbd>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<kbd oncanplaythrough="go()">Keyboard Text</kbd>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<kbd oncuechange="go()">Keyboard Text</kbd>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<kbd ondurationchange="go()">Keyboard Text</kbd>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<kbd onemptied="go()">Keyboard Text</kbd>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<kbd onended="go()">Keyboard Text</kbd>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<kbd onloadeddata="go()">Keyboard Text</kbd>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<kbd onloadedmetadata="go()">Keyboard Text</kbd>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<kbd onloadstart="go()">Keyboard Text</kbd>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<kbd onpause="go()">Keyboard Text</kbd>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<kbd onplay="go()">Keyboard Text</kbd>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<kbd onplaying="go()">Keyboard Text</kbd>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<kbd onprogress="go()">Keyboard Text</kbd>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<kbd onratechange="go()">Keyboard Text</kbd>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<kbd onseeked="go()">Keyboard Text</kbd>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<kbd onseeking="go()">Keyboard Text</kbd>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<kbd onstalled="go()">Keyboard Text</kbd>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<kbd onsuspend="go()">Keyboard Text</kbd>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<kbd ontimeupdate="go()">Keyboard Text</kbd>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<kbd onvolumechange="go()">Keyboard Text</kbd>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<kbd onwaiting="go()">Keyboard Text</kbd>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<kbd onclick="go()">Keyboard Text</kbd>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<kbd ondblclick="go()">Keyboard Text</kbd>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<kbd onmousedown="go()">Keyboard Text</kbd>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<kbd onmousemove="go()">Keyboard Text</kbd>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<kbd onmouseout="go()">Keyboard Text</kbd>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<kbd onmouseover="go()">Keyboard Text</kbd>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<kbd onmouseup="go()">Keyboard Text</kbd>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<kbd onwheel="go()">Keyboard Text</kbd>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<kbd onscroll="go()">Keyboard Text</kbd> 
Window - NONE

Relevant HTML Tutorials

HTML Intermediate - More Text Tags