# Add pronunciation guides with HTML ruby annotations

Canonical: https://githtml.com/guides/ruby-pronunciation-html-reading
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

Use ruby markup to pair a word with a short pronunciation annotation, keeping the original characters in the reading flow. Add fallback parentheses with rp when appropriate, and explain unfamiliar notation nearby. Test the actual language, font, and reader because tiny annotations can become difficult to distinguish on a phone.

## Choose the right representation

Ruby is useful when pronunciation belongs to a particular word rather than to an entire paragraph. A language-learning note might show a Japanese place name with its reading above it. The annotation should help readers decode the term without forcing repeated trips to a distant glossary. Do not use ruby as a general tool for squeezing comments above ordinary English sentences.

## Apply the pattern deliberately

Place the base text before rt inside ruby. Keep separate words in separate ruby groups when their readings should stay associated independently. An rp element supplies punctuation for environments that do not render ruby normally. Declare the language on the relevant passage, and avoid a fixed line height that cuts off the annotation when text grows.

1. Choose one term whose pronunciation readers genuinely need, and keep its annotation concise.
2. Enlarge the passage and confirm that annotations do not collide with the previous line.
3. Read the same sentence without styling and verify that its fallback sequence remains intelligible.

````html
<p lang="ja"><ruby>東京<rp>(</rp><rt>とうきょう</rt><rp>)</rp></ruby></p>
````

## Diagnose crowded or misleading annotations

Suppose a glossary pairs a two-character place name with a four-character pronunciation. When the annotation appears to belong to the following word, inspect the ruby boundary before adjusting font size. One ruby group should represent the intended association. Wrapping an entire sentence in a single group makes that association much harder to follow. Compare the sentence with punctuation immediately after the term, because punctuation can expose a spacing problem that an isolated demonstration misses.

A fixed-height row is another common cause of disappearing readings. The base characters may fit while the smaller annotation extends above the row and is clipped by an overflow rule. Remove that height constraint in a local copy and compare the result. Increase the available line space only where necessary; globally enlarging every line can make a dense glossary unnecessarily long. Preserve the full term and reading rather than clipping either to keep an attractive grid.

Pronunciation is not the same as translation. If a reader also needs the term's meaning, give that meaning in ordinary prose instead of stuffing it into rt. For unfamiliar abbreviations, a definition list or explanatory sentence may be clearer than ruby. Before publishing a learning document, have the pronunciation checked by someone who knows the language and the specific term. A valid HTML structure can faithfully display an incorrect reading.

## Check the finished reading experience

Check both a single annotated word and several consecutive annotations. A line that looks comfortable at the default size may become crowded after enlargement. Ask someone familiar with the language to confirm that the reading itself is correct; valid markup cannot establish linguistic accuracy.

## Sources and further reading

- [MDN: ruby](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby)

## Related guides

- [Find answers in long HTML reports with better search queries](https://githtml.com/guides/search-long-html-report-with-better-queries)
- [Try gitHtml with sample documents before connecting GitHub](https://githtml.com/guides/try-githtml-sample-documents-before-sign-in)
- [How to evaluate a GitHub HTML reader on iPhone](https://githtml.com/guides/evaluate-github-html-reader-iphone)
- [Align numeric report columns without adding spaces](https://githtml.com/guides/align-report-numbers-tabular-nums)

Editorial approach: https://githtml.com/guides/about
