This page explains the concepts of CSS. If you have not already done so you may wish to read the following articles first ... Style sheet concepts
The current thinking in accessible web site design is that data/content (HTML pages with images, boxes, animations etc) and styling (presentational look) should remain separate whenever possible. Data should retain logical semantic flow however it is styled.
Click here for a presentation on the concepts of Semantic mark-up.
Web sites styling should therefore be performed by a linked external CSS (cascading style sheet) document.
Let's be clear about this ...
An HTML/XHTML or dynamic content web page document will contain tags which define structure (div), text, and links to media (images, Flash, video etc) ... but the presentational look (styling) of it will be handled by a separate linked CSS.
Separating the content (html and media) from the formatting (CSS) has 5 primary purposes ...
The building of an XHTML / CSS page could follow this order ...
A Cascading Style Sheets (CSS) is a style sheet for web pages which are HTML3 (or greater) compliant (all current versions of Dreamweaver can create them).
A CSS can contain 1 or more style selectors (or rules). Here is an example of a simple style sheet containing 5 style rules ...
h1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background-color: #003366;
font-weight: bold;
text-align: left;
}p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;}
a:hover {
color: #FFCC00;
font-size: 10px;
}a:visited {
color: #66FFFF;
font-size: 10px;
}a:link {
color: #FFFFFF;
font-size: 10px;
}

HTML uses a system of tags to format (or markup) content. For example, a sentence of text surrounded by the paragraph tag <p> will look like this in HTML code view ...
<p>This is a sentence.</p>
If no further instructions are present, the browser will apply some default property/values (size, typeface, leading etc).
A style rule is a set of "instructions" which overrides the browser defaults to determine the precise appearance of the content in the browser window (normal non code view).
A style rule comprises 2 elements ...
A style rule applies one or more property/value pairs to a tag. For example, the following style rule styles text within a <p> tag with some properties ...
p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
Styles are usually collected together in a style sheet (CSS) which is attached to the html pages.
All style rules have a selector which selects the tag it will apply properties/values to.
In the example above, "p" is the selector (this style rule will style all text formatted with the p - paragraph tag), and "font-family: Verdana, Arial, Helvetica, sans-serif;", "font-size: 10px;" and "color: #000000;" are the property/values which make the style rule.
A property is a formatting option. Properties include things like ...
CSS can control the appearance of a wide range of page elements ...
There are 3 basic types of Cascading Style Sheet (collections of styles) ...
An external CSS is a separate file, stored within the local and remote site folders and which is linked or "attached" to a single or number of HTML pages.
(the external CSS file in this sites remote site folder)
External CSS's must be named in accordance with ISO naming conventions and end in the .css extension.
External CSS files can contain any type of selector styles (discussed below) and can be attached to any number of html pages. If you change a style in the CSS file, all all html pages which contain elements that have been formatted with that style will update to reflect the changes.
Click here for advice on how to create and attach a CSS in Dreamweaver.
CSS works in most version 4 or later browsers such as ...
(NOTE: Pre version 5 browsers can handle CSS erratically).
and ...
Read about CSS browser bugs here.
Now you understand the principals of style sheets you will need to know about the range cascading style sheet selectors.
Read about the different categories of selectors here.
Find us