Difference between revisions of "CSS GUIDE FONT SIZE"
m (→Summary) |
m (→Usage Examples) |
||
Line 47: | Line 47: | ||
== Usage Examples == | == Usage Examples == | ||
<pre>p{font-size: xx-large} /*Set paragraph text to be very large.*/</pre> | <pre>p{font-size: xx-large} /*Set paragraph text to be very large.*/</pre> | ||
− | <pre>h1{font-size: 250%} /*Set h1 (level 1 heading) text to 2.5 times the size of the parent | + | <pre>h1{font-size: 250%} /*Set h1 (level 1 heading) text to 2.5 times the size of the parent or user font table.*/</pre> |
<pre>span{font-size: 8pt;} /*Sets text enclosed within span tag to be standard 8pt font*/</pre> | <pre>span{font-size: 8pt;} /*Sets text enclosed within span tag to be standard 8pt font*/</pre> | ||
Revision as of 16:50, 14 December 2006
This document is a work in progress and is subject to change.
Contents
Summary
The font-size property is used to control the size of a font for a defined section. The size can be declared absolutely or relatively to the user's default font size.
Applicability: | The font-size property can be used for all CSS elements. | |
Inherited: | Yes |
Syntax
TARGET_ELEMENT { font-size: 12pt; } TARGET_ELEMENT { font-size: larger } TARGET_ELEMENT { font-size: 150% } TARGET_ELEMENT { font-size: 1.5em }
Legal Values
Values can be entered in 4 ways:
Method | Range | Example |
---|---|---|
Absolute-size | xx-small | x-small | small | medium | large | x-large | xx-large | "medium" maintains the default font-size |
Relative-size | larger | smaller | (Relative to parent or user font table) |
Length | Positive point value | 12pt. |
Percentage | Positive percentage value | 150%(Relative to parent or user font table) |
See usage examples section for more details.
Mozilla Recommended Values
Usage Examples
p{font-size: xx-large} /*Set paragraph text to be very large.*/
h1{font-size: 250%} /*Set h1 (level 1 heading) text to 2.5 times the size of the parent or user font table.*/
span{font-size: 8pt;} /*Sets text enclosed within span tag to be standard 8pt font*/
Notes
The World Wide Web Consortium (W3C) provides a free online CSS validation service.