Adam's Advanced HTML Guide- Intro to CSS

Css, or cascading style sheets, is a great new technology that allows you to centralize and customize the formatting of virtually all elements in a document. The technology is great- but also at it's infancy- at this stage.

leaf.gif (1184 bytes) A little background

CSS was first introduced by the W3C as a way of giving webmasters more control over the formatting and styling of elements in the document. Using a HTML-like syntax, webmasters declare "styles" either in the header section or directly inside the intended tag to apply styling to it. The most common usage of CSS is to remove the underline beneath all links on your page, and add a "hover" effect to them, so when the mouse moves over the links, the color changes. Here's the CSS for that: 

<style>
a{
text-underline: none;
}

a:hover{
color: red;

}
</style>

The above makes all the links on your page without an underline, and adds a hover effect that changes the link to red when the mouse moves over it.

As another example, you can easily specify that all bold text in your document have a yellow background by adding something like the below to the <head> section of your page:

<style>
b{
background-color:yellow
}
</style>

If you wish only one particular bold element to have this style, simply add the style declaration directly inside the tag:

<b style="background-color:yellow">Bold text</b>

CSS is currently supported by both NS6+ and IE4+, although to varying degrees. This means that it is still not possible to declare one style and expect it to always look the same (or even be supported) on both browsers.

 

Back Home

Recommended resources