Forum Moderators: not2easy
Your css would be something like this:
#link a{background:url("link-normal.jpg") 0 0 no-repeat;}
#link a:hover{background:url("link-hover.jpg") 0 0 no-repeat;}
Other properties you might want to consider are:
a:active - Adds special style to an activated element
a:focus - Adds special style to an element while the element has focus
a:visited - Adds special style to a visited link
<div id = "linkSites">
<a href = "somesite.html"></a>
</div>
and here is my css
#linkSites a{background:url("pic1.gif") 0 0 no-repeat;}
#linkSites a:hover{background:url("pic2.gif") 0 0 no-repeat;}
Any Ideas? Thanks
Nb: 100px is just an example, I would suggest using the actual images widths and heights respectively.
#linkSites a:hover{
background-image:url("pic2.gif");
}
But you can go even neater and put the two images into one file next to one another and then just reposition the background upon hover. It work far faster as the image is already loaded and displayed, you only move it so it is visible.
<a href="http://example.dot"></a>
#link a{background:url("link-normal.jpg") 0 0 no-repeat;}
Of course nothing will display, there's no content between <a> and </a>. The background is probably there, you just can't see it because it's between the two carats ><. Add a few spaces
<a href="http://example.dot"> </a>
And you will probably see it. (DO NOT do this as a "regular practice" for spacing out elements . . . just as an example here.)
Oluoch's second example will probably work best because he/she has applied a width to the anchor.
<a href="http://example.dot"></a>
#linkSites a{
width:100px;
height:100px;
background:url("pic1.gif") 0 0 no-repeat;
}