Jump to content

CSS image rollovers


marmite

Recommended Posts

Hi, the below isn't working. I've tried several combinations, ids, classes, "", "a", "a:hover" etc. No joy.

 

The image doesn't even show.

 

Just want these images to replace each other on hover. Thanks for any help...

 

 

CSS code

# .simcards {
background-image: url(../images/bulk_sim_a.gif);
background-repeat: no-repeat;
height:26px;
width:163px;
margin:0px;
padding:0px;
}

# .simcards a{
background-image: url(../images/bulk_sim_a.gif);
background-repeat: no-repeat;
height:26px;
width:163px;
margin:0px;
padding:0px;
}

# .simcards a:hover{
background-image: url(../images/bulk_sim_b.gif);
background-repeat: no-repeat;
height:26px;
width:163px;
margin:0px;
padding:0px;
}

 

Html code

	<td width="163px"><div class="simcards">
		<a href="/index.php" ></a>
	</div></td>

Link to comment
Share on other sites

tables eh? euch ;)

 

using that 'markup'

<td width="163px">
<div class="simcards">
  <a href="/index.php" ></a>
</div>
</td>

 

css...


div.simcards a
{
background: transparent url(../images/bulk_sim_a.gif) no-repeat 0 0;
display: block;
height:26px;
width:163px;
margin:0px;
padding:0px;
}

div.simcards a:hover
{
background-image: url(../images/bulk_sim_b.gif);
}

 

You can help prevent the 'flicker' on the first hover (as the browser downloads the hover image for the first time) by having just the one image. put bulk_sim_a.gif and bulk_sim_b.gif into one file (one above the other so that the new image is twice as high - i will assume that would produce and image 52px in height). If you do that then all you need do is shift the back ground poistion like so...

 


div.simcards a
{
background: transparent url(../images/bulk_sim_a.gif) no-repeat 0 0;
display: block;
height:26px;
width:163px;
margin:0px;
padding:0px;
}

div.simcards a:hover
{
background-position: 0 26px;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.