Wildfire Home Image [4k]

FAQs - CSS - Answers

How can I comment my stylesheets?

You can comment your stylesheet by surrounding the text to be ignored with "/* */". Any text in the comment is ignored. Here is an example:

<STYLE>
/* This is ignored*/
P {color:red;}
</STYLE>

Is CSS case-sensitive?

CSS Is not case-sensitive however, there are parts that are not controlled by CSS that may be case sensitive. These are things such as URLS and font names. Be careful when dealing with URLS. A good site-management tip is to make all your files lower case so there can't be any mistakes in addressing files.

How do I remove the underlining from links?

You can remove the underlining from links easily. There are four CSS definitions to affect links (the <A> tag). These affect it when the link is unvisited, visited, active, or the mouse is over it. The example below shows how to remove the underlining for all of them (and change their colors):

<STYLE>
A:link {text-decoration:none; color:blue;}
A:visited {text-decoration:none; color:green}
A:active {text-decoration:none; color:red}
A:hover {text-decoration:none; color:gold}
</STYLE>

 

Can you have more than one stylesheet to a page?

Yes, you can have as many stylesheet definitions on the page. These all cascase down. For example you could link to a default stylesheet for the whole site and then link to a stylesheet that only a few pages on your site use. The styles cascade down.

What are pseudo-classes?

A pseudo-class is a class that is made up for the benefit of CSS. The class does not exist in HTML. At the moment there is only one example. The <A> tag for links. This can have four imaginary classes, unvisited, visited, active and 'hover' for when the cursor is placed over it. A CSS rule can be applied to each of the classes, so if the link changes state then a new class is applied. Example code:

A:link {color:blue;}
A:visited {color:red;}
A:active {color:green;}
A:hover {color:gold;}

What are pseudo-elements?

Pseudo elements are elements, that do not exist in HTML, much like Pseudo classes, but are made up for the benefit of CSS. There are two attributes that can be set as pseudo-elements. These are 'first-line' and 'first-letter'.

P:first-line {font-weight:bold;}
P:first-letter {text-transform:uppercase;}

This can be used with text elements, not just the paragraph tag.

Can I add more than one declaration to a selector?

Yes you can. Just seperate them with semi-colons ";":

P {color:blue; font-weight:bold; }

© Jamie McHale 1998 - 2000 - http://www.btinternet.com/~wildfire/