CSS Basics
Let's look at the elements of CSS you really need to know well:
- div
- A layout and design tool. When you surround a block of text, or a block of text and images, in <div> tags (HTML), you can use div id or div class (CSS) to position or change other aspects of (such as the background color or width) only that block.
- background
- Allows you to change the background attributes (such as color) of an element such as a paragraph, link, div, or entire Web page.
- color
- Allows you to specify the color of text.
- margin
- Allows you to specify the width of top, right, bottom and left margins -- for any element such as a paragraph, link, or entire Web page.
- padding
- Allows you to specify the width of top, right, bottom and left padding inside an element -- for any element such as a paragraph, div, or image.
- border
- Allows you to specify the thickness, style and color of a border -- for any element such as a paragraph, div, or image.
- font-family
- Allows you to specify a hierarchy of font families for any element such as a paragraph, div, or entire Web page.
- font-size
- Allows you to specify the size of the font for any element such as a paragraph, div, or entire Web page.
Styles for Links in CSS
There are five of these:
- a:link
- a:active
- a:hover
- a:visited
- a:focus
You really need to specify ALL FIVE in your CSS. If you don't, users are likely to see some ugly color effects. Your links might even be invisible!
If you don't feel like specifying all of them, at least spec a and a:hover. But be aware that a alone will also affect name anchors: <a name> </a> in HTML, which you may or may not be using. (See this page for more information about name anchors.)
Tutorial
Go to w3schools.com for the best free CSS tutorials.