<ruby> Tag Syntax

Rules for coding HTML ruby elements
<body>
   ...
   ... phrasing content expected ...
   <ruby>... phrasing content ...
      <rp> (</rp><rt>... phrasing content ...</rt><rp>) </rp>
      ...
   </ruby>
   ...
</body>
Rules for coding HTML ruby elements

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Code the ruby element for ruby annotated text where phrasing content is expected.
  2. Begin the ruby element with a starting <ruby> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include any HTML global attributes on the <ruby> tag as appropriate.
  4. Inside the ruby element, between the starting <ruby> tag and the ending </ruby> tag, code the inner HTML phrasing content as appropriate, along with any rt elements optionally bracketed with rp elements.
  5. End the ruby element with a matching </ruby> closing tag.
Content Model
Content of the ruby element

The content of the ruby element can include HTML comments, text content and groups of HTML tags that can be used in phrasing content, with each group followed by either a single rt element or a sequence of an rp element, an rt element and another rp element.