by Vivienne Trulock
Created and designed by Vivienne Trulock for ilikecake, 2005
Style sheets are a way of ensuring that all the elements of a page - header, paragraph etc. - are the same from one page to the next. Style sheets can also be used to layout a page. There are several different flavours of style sheets. The simplest type of style is to modify an existing HTML tag. Using the template that you worked on in the template page and these images, we will make a replica of this page. Save the images into your images folder before beginning.
Click on 'Window > CSS
Styles' to open the CSS
window.
Click the 'New Style Sheet' icon - the button at the bottom with the
+.
Click 'Redefine HTML tag''. In the 'Tag' dropdown menu select 'p'. We
are going to define a style for 'paragraph'.
Make sure that 'New Style Sheet File is selected'. Browse to your local
folder and in the filename box type in 'my_style'. The style sheet file
is saved as a .CSS file.
Click 'Save'.
The next window allows you to change the font attributes for 'paragraph'.

This specifies the font, the size and the line spacing:
This specifies how we want the text to layout - justified is the same as in word processing - the text is aligned both on the right and the left.
To test the styles, type in some text, highlight it and in the 'Format'
drop down menu in the properties window select 'Paragraph'.
Use the following settings to define more HTML tags which occur in the site
This specifies the font, the size, the line spacing and the colour of the text:
This specifies the background colour, the background image, how the image should repeat and its horizontal and vertical position on the page. The image in this case is the footer at the bottom of the page.
This specifies that there is no margin so the <body> takes up the entire space of the page.
letter spacing: 1px
You can also create a custom class. You do this if you just want to apply a certain font size or colour etc to a small amount of text.
Click on 'Window > CSS Styles' to open the CSS window, as above. Click the 'New Style Sheet' icon, as above. Click 'Make Custom Style (Class)'. In the Name drop down menu, type in the name of your custom class - example 'invisible'.
The invisible class attribute allows us to make content invisible by applying this class to a tag. In this case, it is applied to a skiplink which we want to only be 'visible' to blind users - it will be read out by screen readers but invisible in visual browsers.
Because we have already set up our style sheet name in a previous exercise, it comes up automatically selected. Click 'OK'. The next window allows you to change the font attributes for your tip, as in the previous exercise. To test the styles, type in some text, highlight it and click on the new styles 'invisible' in the CSS window. (Window > CSS)
The last type of style sheet deals specifically with links and rollovers. This type of style allows you to create rollovers without making images.
Click on 'Window > CSS
Styles' to open the CSS
window, as above. Click the 'New Style Sheet' icon, as above. Click 'Use
CSS Selector'.
In the Selector drop down menu, there are four different options.

Select one option at a time and assign attributes to each of the link
states. If you don't want an underlined link, just select the 'None' checkbox
in the 'Decoration' options.

Use the settings below to create a link style
To test the styles you must have some linked text. View the page in the browser window to see the results.
What if you want to link a new page to an existing style sheet? No problem...
Open a new page in Dreamweaver and open 'Window > CSS
Styles', as above. Click the 'Attach Style Sheet' icon - the first button
at the bottom.

'Browse' and click on 'mystyle.CSS' and click 'Select'. Test the styles in the same way as before.