RSS

How to Make an Image Rollover in CSS

Mon, Dec 1, 2008

Tutorials, Videos

In this tutorial I will teach you how to make an image rollover using CSS and Adobe Illustrator. It’s pretty straightforward and shouldn’t take you more than a couple of minutes. I’ve included the HTML, CSS, and image below the video.

If you like this tutorial please make it known by bookmarking it and commenting below.

index.html

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Home Button</title>
<link type=”text/css” rel=”stylesheet” href=”style.css”>

</head>

<body>

<a class=”homebutton” href=”#”>Home</a>

</body>
</html>

style.css

@charset “UTF-8″;
/* CSS Document */

a.homebutton {
display:block;
width:120px;
height:40px;
text-indent:-5000px;
background:url(images/homebutton.jpg);
text-decoration:none;
}

a:hover.homebutton {
background-position: -120px 0;
}

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google

Technorati Tags: , , , ,

If you enjoyed this post, make sure you subscribe to my RSS feed!

, , , ,

2 Comments For This Post

  1. Owen Says:

    For some reason this simply won’t work for me…. Can you check your code?

    Best,
    Owen

  2. Owen Says:

    Oh, sorry about that duder. I figured things out… Dreamweaver is such a pain at times. One note: I think there should be a forward slash to end your ‘link’ tag.

    Cheers,
    Owen

    P.S. I’ll be keeping an eye on your tutorials. You’re a great teacher.

Leave a Reply