Aligning Elements Vertically

You can align elements in many different ways to make them look neater on the page.

To position elements vertically:

1.
Type vertical-align:
2.
Type baseline to align the element’s baseline with the parent’s baseline. Or type middle to align the middle of the element with the middle of the parent. Or type sub to position the element as a subscript of the parent. Or type super to position the element as a superscript of the parent. Or type text-top to align the top of the element with the top of the parent. Or type text-bottom to align the bottom of the element with the bottom of the parent. Or type top to align the top of the element with the top of the tallest element on the line. Or type bottom to align the bottom ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.