Main Menu
Multiwingspan Home Page
Multiwingspan Games
Gnasher @ Multiwingspan
Multiwingspan Calendar
Multiwingspan Clock
About Multiwingspan
Programming
Visual Basic 6.0 Guide
Visual Basic 6.0 Examples
Turbo Pascal Guide
SWI Prolog Guide
Visual Basic 2005 Guide
Structured Query Language
Web Design
HTML Design Tasks
Introduction To HTML
Introduction To CSS
Introduction To Javascript
Notes
AS/A2 Level Computing

Cascading Stylesheets Guide
Embedded Stylesheets

All style definitions must be entered within the <style> tag which is usually (but does not have to be) placed in the <head> section of the web page.

example of a style definition

<style type="text/css">
H1 {
font-family: Arial;
font-size: 12pt;
}
</style>

Each style rule is made up of the selector (in this case H1) and the declaration block (everything between the curly braces). In this case all instances of the H1 tag in the web page would be displayed using the font Arial and in 12pt size. Notice that each declaration is separated from the others with a semicolon.

Imagine that you only want these style rules to apply to some instances of the H1 tag. The style rules would then be specified as follows…

<style type="text/css">
H1.apply {
font-family: Arial;
font-size: 12pt;
}
</style>

To apply these rules you would enter the H1 tag as follows…

<h1 class="apply">My heading</h1>

To have rules which can be applied to more than one type of tag you could modify the selector further.

<style type="text/css">
.apply {
font-family: Arial;
font-size: 12pt;
}
</style>

Any tag which has the attribute class="apply" would now be displayed following these rules.

Return To CSS Guide || Return To Homepage