Working With the Language Elements in HTML5

The ruby, rt, and rp elements

Ruby characters are notations placed above or to the right of characters in a logographic language (such as Chinese or Japanese).

We use a ruby element in conjunction with the rt and rp elements, that are also new in HTML5.

The rt element marks the ruby notation, and the rp element denotes parentheses around an annotation that can be displayed by browsers that don’t support ruby annotations.

Example

<html>
<head>
    <title>Ruby Example</title>
</head> 
<body>
    <p>
        Abhijeet aka
        <ruby>AJ <rp>(</rp><rt>Abhijeet</rt><rp>)</rp
</ruby>
    </p>
</body>
</html>




The bdo Element

The bdo element specifies an explicit text direction for its content, overriding the automatic directionality that would usually be applied. We must use the bdo element with the dir attribute, that has the allowed values of rtl (for right-to-left layout) and ltr (for left-to-right layout).

Example

<html>
<head>
    <title>BDO Example</title>
</head>
<body>
    <p>
        It isleft-to-right: <bdo dir="ltr">Hello guyz</bdo>
    </p>
    <p>
        It is right-to-left: <bdo dir="rtl">Hello
guyz
</bdo>
    </p>
</body>
</html>





The bdo element specifies an explicit text direction for its content, overriding the automatic directionality that would usually be applied.

 

Up Next
    Ebook Download
    View all
    Learn
    View all