how to use ruby in html

<!-- The <ruby> tag is used to display smaller text on top of another
	 element. While it was designed for annotating Asian languages,
     it can be useful as a quick way of overlaying text. -->

<!-- The <ruby> tag is a block container for ruby annotations. -->
<ruby>
	To be or not to be
</ruby>


<!-- To superimpose text, you place it within an <rt> tag.
	 Any words before <rt> will serve as "anchor" for the superimposed
     text; here for instance "to be" will be spread over "or not to be" -->
<ruby>
    or not to be
    <rt>To be</rt> <!-- Superimposed across "or not to be" -->
</ruby>


<!-- In this example, "To be" will be spread only over "or not".
	 This reduces the spacing between the annotations. -->
<ruby>
    or not 
    <rt>To be</rt> <!-- "to" over "or", and "be" over "not" -->
    &nbsp;to be
</ruby>


<!-- For browsers that do not support the <ruby> tag,
	 the <rp> tag can be used to show parentheses around the
     annotations.-->
<ruby>
    or not 
    <rp> ( </rp>
    <rt>To be</rt>
    <rp> ) </rp>
    &nbsp;to be
</ruby>


<!-- Tip: You can change the spacing of the annotations by changing the
	 text-align property of the <rt> tag. This can be useful for easily
     creating text overlays in almost pure HTML (e.g. button labels). -->
<ruby>
    or not 
    <rp> ( </rp>
    <rt style="text-align: left">To be</rt> <!-- Default is text-align: start -->
    <rp> ) </rp>
    &nbsp;to be
</ruby>

<!-- Note that <ruby> support is still limited: while most browsers have
	 partial support, only Firefox has full support.
     
     See: https://caniuse.com/?search=ruby -->

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source