Use the vertical-align property to set the vertical position of an element on a line. The vertical-align property is a bit difficult to understand. First you must understand the difference between block elements and inline elements.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Vertical Align an Element

Use the vertical-align property to set the vertical position of an element on a line. The vertical-align property is a bit difficult to understand. First you must understand the difference between block elements and inline elements.

Block elements usually start on a new line and cause the element that follows them to start on a new line. Examples of block elements are headings <H1>, paragraphs <p>, and horizontal rules <hr>. Inline elements usually flow one after another from left to right on a webpage. Examples of inline elements are text, images and spans <span>. The vertical-align property is applied to inline elements.

You must also understand the difference between baseline and bottom. The baseline is an imaginary line that text is written on. It does not include the space used for decenders. Examples of decenders are the curves at the bottom of lower-case j and g. Sometimes the vertical-align property works relative to the baseline, and other times it works relative to the bottom, which include the space for the decenders.

Do not consider this article an authority on the vertical-align property, because I can't find any source on the Internet that defines this property in plain-simple English with example code and provides visual examples. But you should be able to find the answer you need here because I DO provide code and working examples.

vertical-align:top

Align the top of the element to the top of the tallest element on the line.



<img src="red.gif"><img style="vertical-align:top;" src="green.gif">

vertical-align:bottom

Align the bottom of the element to the bottm of the line. (not to the baseline which does not include the space used for decenders).

TEXT

<img src="red.gif">TEXT<img style="vertical-align:bottom;" src="green.gif">

Earn $1 to $5 to complete survey

Web Design Sections
CSS Quick Reference
Use Inline Style
Use an Embedded Style Sheet
Use an External Style Sheet
CSS Units of Measurement
Specifying Color
Set the Text Color
Set the Text Alignment
Set the Letter Spacing
Set the Word Spacing
Set the Line Spacing
Highlight Text
Indent the First Line of Text
Set the Text Decoration
Set Text Justification
Set the Font Family
Set the Font Style
Set the Font Boldness
Set the Font Size
Set the Font Variant
Style the First Letter
Style the First Line
Set the Background Color
Set a Background Image
Set a Background Image's Position
Set a Fixed Background Image
Set the Background Properties
Set the Border Properties
Set the Border Style
Set the Border Width
Set the Border Color
Set an Element's Margin
Set an Element's Padding
Set an Element's Clipping
Set an Element's Overflow
Set an Element's Position
Set an Element's Float
Color the Scrollbar
Set an Element's Overlap
Set an Element's Visibility
Vertical Align an Element
Define CSS Rollover Effects
Web Designer's Reference
[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269