www.RickBull.com > tutorials > Cascading Style Sheets > Basics of Style
Jump to: Contents | Part 1 | Part 2 | Part 3 | Answers | FAQ

Frequently Asked Questions

This page answers some Frequently Asked Questions regarding CSS:

When I define a background colour and try to validate my CSS file, I get the warning No color defined for [element in question]. Why is this?
When you define a background colour, you also need to specify the foreground colour; imagine if you define your body's background colour to be black, and it's foreground colour to be white, but change a DIV's background colour to be white it's foreground colour will be inherited and so both it's fore and background colour will be white, making the text basically invisible. So you must specify a background colour when you specify a foreground colour. The same is true for the other way round: you must specify a foreground colour when you specify a background colour. If you don't want a background colour (and you are sure it will remain readable) set it to transparent.
How can I make a side-line, or list of links to other pages on my site that runs down the side of my pages?
Well there is more than one way to do it, but this is the method that I use:
The CSS code:
#menu { /* Make the menu "float" in 
           the top left-hand corner */
  position:absolute;
  top:0px;
  left:0px;
  width:9em;
}
body { /* Make the body not overlap the menu */
  margin-left:10em;
}
The HTML code (just before the </body> tag):
<p>All of your body's text goes here</p>

<!-- Start of the menu section -->
<div id="menu">
  <a href="#">Your links go here</a>
  <a href="#">More links go here</a>
  <a href="#">Etc.</a>
</div>
I have a style-sheet that works well in one browser, but not another, is there anyway around this?
There are various tricks for different browsers, please take a look at the browser work-arounds tutorial for more details.

All tutorials and content written by Rick Bull unless otherwise stated
Page's last update: Friday, 15th January 2010; 12:53:43 GMT +0000
Official CSS Level 1 documentation: http://www.w3.org/TR/REC-CSS1
Official CSS Level 2 documentation: http://www.w3.org/TR/REC-CSS2
Top of the page