How do I make Super or Subscript letters and numbers using HTML?
Like those neat little footnotes you can add when doing word processing so you can properly annotate all of your sources? Of course not. But do you want to know how to achieve it anyway using HTML? Sure you do.
This was something I assumed, wrongly, that was done with CSS. But there are actually HTML tags to achieve subscript and superscript footnote type annotations. These are the two tags;
<sub></sub>
<sup></sup>
Surround the number, or whatever else you may be using these tags for, with this markup and you have your effect. You can redefine the selector in CSS, but I didn’t have much luck. I added a font-weight:bold to the selector, but when trying to adjust the font size, when set to font-size:10px I couldn’t see the number as good as when I didn’t set a font size.
Now, when I was reading about these two tags, I read that sometimes they can cause some problems with line height and making your line spacing look larger between lines in places where there is subscript or superscript. You can easily adjust that by added a little line height for your paragraph<p> for a certain section or a specific class, something like this;
p.lineChange{
line-height:20px;
}
or
.lineChange{
line-height:20px;
}
Here are some similar arcade posts
- Are height properties depreciated in XHTML 1.0?
- Why can’t I set the table height attribute to 100%
- Shortcuts for marking up a paragraph or a comment in Dreamweaver.
- What does the acronym XMLNS stand for, what does XMLNS mean?
- Which should I use, relative or absolute positioning?
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.











Comments
No comments yet.
Leave a comment
Your email address is never displayed and cannot be spammed. Read our comment privacy policy.