HTML and CSS Reference
In-Depth Information
Lengths are set often in points (
pt
), pixels (
px
), picas (
pc
), inches (
in
), millimeters (
mm
), or
centimeters (
cm
). Standard relative sizing units in em (
em
) and x-height (
ex
) may also
be used, as well as percentage values like 90%. Percentage values set the font size to a
percentage of the current inherited
font-size
. The property also supports size keywords
(
xx-small
,
x-small
,
small
,
medium
,
large
,
x-large
,
xx-large
). The size keywords are
roughly equivalent to the 1-7 size values for a
<font>
tag and also should be equivalent to
particular stock HTML heading sizes. Table 5-9 summarizes the typical relationship between
CSS and HTML, though implementations may vary.
The relative size keywords
larger
and
smaller
should adjust a current size up or
down one value.
Examples
body {font-size: 18pt;}
#heading1 {font-size: 36px;}
p {font-size: 2em;}
h6 {font-size: xx-small;}
.special {font-size: 75%;}
Compatibility
CSS 1, 2, 3 IE 4+
Netscape 4+, Firefox 1+
Opera 4+, Safari 1+
font-style
This property sets the style of a font.
Syntax
font-style: italic | normal | oblique | inherit
The
normal
value would be used to override any inherited
font-variant
value.
Examples
.backToNormal {font-style: normal;}
#special {font-style: oblique;}
p.emphasis {font-style: italic;}
CSS
Keyword
xx-small x-small small medium large x-large xx-large
HTML
<font>
Size
1
2
3
4
5
6
7
HTML
Heading Size
<h6>
<h5>
<h4>
<h3>
<h2>
<h1>
T
ABLE
5-9
CSS-HTML Size Relationships