CSS Navigation Types
Any type of dynamic web site that is seen online has some sort of interactive navigation system. Whether it is graphics, text, Flash, Swish, JavaScript, or CGI based, these main links can be an intigral part to any web design. For this tutorial we will look at a few of the various types of CSS-based navigation; plain text, colored backgrounds, and image backgounds.
Plain Text Links
Text links can be handy in many ways. Not only can they be edited rather easily and quickly (i.e. a simple .INC file if you are using PHP or ASP), but they also work well with software designed for handicapped or visually impared viewers. A good, clean text navigation should be a bold-faced, sans-serrif font with no type of text decoration added to it unless the design of your site calls for the font to be italicized. You should also look at the color of your font. For this particular example we are going to use black font on a white background with a medium-dark shade of blue for the link color.
|
We’ll start by defining our links in the CSS file by using the In the second section of code, |
|
Using Colored Backgrounds
Adding some color to your links can be helpful to determine what navigation links are the main links to your page, and which ones are sub-navigation links. Using CSS code, you can quickly and easily identify each class of the link you wish to have as well as change the color surrounding the text for your link.
|
We’ll use the same code as before and develop it more to fit our needs. I’ve left the color and the size of the font the same, but added a background color behind it, some padding around the font to make the links bigger, and using the When the visitor moves their mouse over any part of the colored box, it will act as the link, giving your site the illusion of a colored table or mouse-over button that is controlled by JavaScript, without the confusion of writting all that Java code. In the second portion, the |
|
You can use the same idea for having a transparent link and changing the color of a border. Instead of including the background-color code, use border: [insert border color, type, and width]. In your a.Navlink:hover class you will just change the color of your border.
Using Background Images
CSS makes it very easy to change the background image of a navigation link without having to write all that complicated and confusing JavaScript code. Similar to how we define the text and background color in the regular link and hover link (mouseover), we define different images using the background-image command.
There are some limitations, however, to using this style of navigation links. The biggest one is that images take time to load and will not change instantly until the viewer has the image stored in their brower’s cache. If the viewer has image caching turned off, your links will never change instantly. For this example we are going to get around this problem by using a multi-layer image.
A multi-layer image is a set dimension image with different layers for each style of navigation button you wish to you have (one for standard button, one for mouseovers, and one for when you click on it). All these layers are included in one image. For this example, our image is 170px wide by 60px tall and is divided into three 20px tall sections for each of our different stages of activation.
|
This time we will add the In Finally you want to add a bit more class to your page? How about changing the image when a user clicks on the link. This is the |
|
All of these examples will help you create interactive navigation links for your web site without having to use complicated code or special programs. If you would like to view examples of all three styles you can click here. The CSS page for the site can be accessed directly from it by right clicking on the CSS link provided.
No comments yet.

