Modern Front End Tech logo

modern front end tech

word breaks and ruby

Control long words and add pronunciation notes for text that needs extra help.

HTML helper elements

Small tags can improve readability

HTML has a few text helpers for special cases. Use <wbr> to suggest a safe line break inside a long word, and use ruby elements for pronunciation annotations.

Word breaks

Use <wbr> inside long words

The <wbr> element tells the browser where a long word may break if it does not fit on one line. It does not force a line break.

super<wbr>long<wbr>frontend<wbr>word

superlongfrontendword

Ruby text

Use <ruby> for pronunciation notes

Ruby annotations are often used with East Asian text. The base text goes inside <ruby>, and the pronunciation goes inside <rt>.

<ruby>
    漢 <rp>(kan)</rp><rt>かん</rt><rp>(kan)</rp>
    字 <rp>(ji)</rp><rt>じ</rt><rp>(ji)</rp>
</ruby>
(kan)かん(kan)(ji)(ji)
Checkpoint

Use these only when they help

Add <wbr> to long words that may overflow. Add ruby markup when the reader needs pronunciation or annotation support.

our youtube channel