| What is CSS Source : http://www.voidix.com Author : voidix Published on : January 13, 2007 |
||||||
What Does Cascading Mean? Most simply, cascading means that multiple style sheets can be applied to a single webpage. However, what is more important is that developers can apply an order of precedence for the browser that tells it which styles to apply first when multiple sheets are involved. History Style sheets were first invented in 1997, and since, have slowly become more widely used. Today it is hard to find a modern web design that does not implement css. The CSS Syntax The css syntax is fairly easy to understand. The selector tells us what part of your page will be affected, the declaration tells us how what we have selected will be affected. In more direct terms, a simple css style would look like selector {property : value;} There are many values that can be placed into the selector, property, and value areas. If I wanted to change the look of my Header1 tags (<h1> tags) “h1” would be my selector. If I wanted to change the color of my header, the property would be “color” and the value would be the hexadecimal color. For example, h1 {color : #CCCCCC;} Css can also be used to affect only certain aspects of your page. If you only wanted a certain block of text to change colors, you can change the class of that text, and give that class a style. For example, I could give a span of text the class “gray” and then make a style in my style sheet with the selector “gray.” .gray {color: #CCCCCC;} Attaching CSS Files To a Webpage Attaching a css style sheet to your website is simple. All you need to do is add a link in the following form to your .css file, in between the head tags of your website. <link rel="stylesheet" type="text/css" href="stylesheet.css"> You can also place the styles themselves in between your head tags by putting them between two style tags. <head> <style type="text/css"> h1 {color : #CCCCCC;} </style> </head> |