U of S | DCS | Courses | CAI | CSS | Attaching to Tags

[Back] [Contents] [Next]


Attach Styles to HTML Tags


Style definitions must be attached to "selectors" (normally HTML tags) that control when the definitions are used. This is done by listing the HTML tag name, then inside curly braces {...} the definitions, separated by semicolons (";"), as in:

HTML-TAG {property1:value1; property2:value2; ...}

For example, to set all <h1> tags so the text appears in 12-point sans-serif font use this command:

h1 {font-size: 12pt; font-family:sans-serif}

Please send comments about this course to Kevin.Lowey@Usask.CA