Submit Your Article
Home Articles News Tutorials Videos Add An Article
Topics: Design Photoshop Programming PHP CSS Java Database Web Development Javascript Ajax
– Close + Open

Find Out More About DevWebPro!

Sign up for the newsletter


» Terms & Conditions

Welcome to the New DevWebPro!

DevWebPro Includes:
  Hundreds Of Tutorials   Developer News
  Unique Gadget Videos   Tons of Topics to Discuss
  Expert Advice   We Will Publish Your Articles

CSS Rollovers

By: Derald
Tuesday, May 27th, 2008
Text: Decrease Font Size Increase Font Size | Print Print Article | Share: Delicious Digg StumbleUpon Post to Twitter Post to Facebook

Javascript is a great scripting language used for creating websites. One of the more popular uses of JavaScript is the use of rollovers. There is a draw back with JavaScript rollovers, you have to use images to create the effect.

This means that you have to preload the images, which to people who have a slower connection this means the page takes longer to load. With CSS, you can use the :hover pseudo-class to get a similar effect. Here is an some example code that would create a rollover.

a {
 color: #FFFFFF;
 background-color: #94CB2E;
}

a:hover{
 color: #94CB2E;
 background-color:  #FFFFFF
}

It is just that simple, when a user rolls their mouse over top of the anchor elements, the background and text color will invert. For an example of this type of effect use your mouse to rollover the categories to the right of this article.

Topics: , ,

About the Author:

Leave a Comment

DevWebPro is an iEntry Network ® publication - © 1998-2010 All Rights Reserved