You can give the vertical-align property any of the following eight descriptive
values: bottom, baseline, middle, sub, super, text-top, text-bottom,
and top. Or you can supply a specific measurement (such as 4px) or a
percentage.
Using descriptive values ..................................................................
In CSS, alignment is made relative to any line-heightproperty used with
the text. Most of the values that can be used with vertical-alignare self-
explanatory, but text-bottommeans that the baseline is ignored and the
imaginary line is drawn at the bottom of the typeface’s descenders.
Within block level elements, the vertical-alignproperty has no effect rela-
tive to the block. However, the property does work to align elements within
the cells of a table.
As you can see in Figure 7-10, the baseline is an imaginary line drawn
between characters without descenders.
This is the HTML file that produces the result shown in Figure 7-10:
<html>
<head>
<style>
img {vertical-align: baseline;}
body {font-size: 24px;}
Figure 7-10:
This
image — a
rectangle
— aligns
with the
baseline,
which is the
default if
you don’t
specify a
vertical
-align
property.