[css3.svg]CSS - how to create subscript and superscript text

To create subscript and superscript text in CSS, use the vertical-align property with the value sub and super respectively.


This is subscript


 <html>
     This is <span class="sub-text">subscript</span>
 </html>
 
 .sub-text {
     vertical-align: sub;
 }
 

This is superscript


 <html>
     This is <span class="super-text">superscript</span>
 </html>
 
 .super-text {
     vertical-align: super;
 }
 

This article demonstrates sub and super with CSS, but you can also use HTML tags.



Ads by Google

Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath