HTML <rt> tagS2C Home   « HTML <rt> tag

Definition

The <rt> tag specifies the ruby text component of a ruby annotation; this is normally a pronunciation or explanation.

The <rt> tag must be nested within an <rtc> or <ruby> tag.

The closing </rt> tag may be omitted if the <rt> element is immediately followed by another <rt> tag, the <rp> tag or if there is no more content in the parent element.

The <rt> tag was introduced in HTML5.

Example


<ruby>
  伦 <rp>(</rp><rt>lún</rt><rp>)</rp>
  敦 <rp>(</rp><rt>dūn</rt><rp>)</rp>
  <rtc> London</rtc>
</ruby>

(lún)(dūn) London

Attributes

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


<rt> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <rt> tag.
<rt> 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.

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

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

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

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

<rt accesskey="a">Ruby Text</rt>
tabindexSpecifies a tab order for the element.

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

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

<rt lang="en">Ruby Text</rt>
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. -->
<rt spellcheck="true">Ruby Text</rt> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 <!-- Executes go() function -->
<rt oncanplay="go()">Ruby Text</rt>
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 -->
<rt oncanplaythrough="go()">Ruby Text</rt>
oncuechangeThe script to be run when the cue changes when using the track element.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Relevant HTML Tutorials

HTML Basics - Language Tags