Difference between revisions of "CSS GUIDE FONT SIZE"

From CDOT Wiki
Jump to: navigation, search
 
m
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
== Summary ==
 
== Summary ==
  
The font-size property is used to control the size of a font for a defined section.  The size can be declared absolutely, relatively to the user's default font size.
+
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.
 
<table border="0">
 
<table border="0">
 
<tr>
 
<tr>
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 of user font table.*/</pre>
+
<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>
  
Line 61: Line 61:
  
 
== See Also ==
 
== See Also ==
 +
 +
<big>[http://zenit.senecac.on.ca/wiki/index.php/CSS_guide#CSS_Properties Back to CSS Index]</big>

Latest revision as of 21:51, 14 December 2006

This document is a work in progress and is subject to change.

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:

MethodRangeExample
Absolute-sizexx-small | x-small | small | medium | large | x-large | xx-large "medium" maintains the default font-size
Relative-sizelarger | smaller (Relative to parent or user font table)
LengthPositive point value12pt.
PercentagePositive percentage value150%(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.

Specification Conformance

Browser Compatibility

See Also

Back to CSS Index