Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

CSS RULES

Cascading Style Sheets are a set of rules that govern the display of the document through a web browser. The rules simply are lines of command codes that tell the browser how to display the information.  It is crucial with CSS to get the syntax of the command lines correct to keep any frustrating errors from popping up.

What does a rule look like?

The SELECTOR selects (determines) which HTML element you’re working with. HTML elements are common tags like <body>, <H1>, <p>.  Often the selector is referred to as an element selector or a type selector.

 The DECLARATION tells the browser what to do with the Selected element. It consists of two parts:

 The PROPERTY, which identifies which attribute like font type, size and color, for example, is called into play.

 The VALUE, determines how the attribute works, in other words it causes the action that changes the font type, size and color to what the property asks for.

A declaration is always signaled by  a { bracket and is ended with a closing }.

A property is separated by a : and a ; ends each declaration.

An example of a Declaration:

Why does the code look like this? Browser can read the code in single lines or in staggered lines like the example above. The reason for the staggered line is so our eyes can more easily catch silly errors that can end up costing valuable programming time.

Ok, so you're thinking that you could get the same result by just tagging <H1> each with <font color="blue" face="arial">. You could, but what if you have a 20 page site and you want to change the from blue to orange. With one simple change you can change the entire site, and quickly change it back if you hate the new look. That's the beauty of CSS.



 
 
  Copyright 1997-2002 Idocs inc. Published under the terms of the Open Content License Design by Interspire