Jump to content

CSS Rollovers


Kitty

Recommended Posts

I have a CSS rollover menu and it works great in Firefox, but not in IE. When I hover over the buttons they look ugly and the background disappers for a few seconds. I tried fixing it by adding

 

* html .nav a:hover {

visibility: visible;}

 

but that only fixed the font.

 

Here's my CSS:

 

.nav a {
display: block;
width: 188px;
background: inherit;
background-image: url(images/link.jpg);
padding: 11px 0px 11px 0px;
text-indent: 17px;
text-decoration: none;
text-transform: capitalize;
font: bold 9pt Verdana, arial;
color: #CCCCCC;}

.nav a:hover {
background: inherit;
background-image: url(images/hover.jpg);
color: #FFFFFF;}

* html .nav a:hover {
visibility: visible;}

And HTML:

 

<div class="nav">

<a href="#">» Link goes here</a>
<a href="#">» Link goes here</a>
<a href="#">» Link goes here</a>
<a href="#">» Link goes here</a>

</div>

 

I can't use javascript, cos it requires to put my buttons directly on the page, but I have them all as backgrounds...

 

So, is there anything I can do to fix this, or is IE hopeless?

 

Hope someone can help!

Link to comment
Share on other sites

The background will disappear in any browser. If you use javascript to preload the image, you shouldn't have this problem... If done right, even if the javascript isn't supported, the worst that will happen is the background will disappear for a second.

 

You may want to take a look at this:

http://www.firemelt.net/scripts/css_rollover/

The CSS is inline so you can see it when you view the html. This works in IE.

 

You may be able to use the CSS above as a base to build yours.

 

I hope this helps, if not please ask.

 

I don't like javascript rollovers either...

Link to comment
Share on other sites

Have a look at using the background position property. You will have ONE image which as the image AND the 'roll-over' in one (so twice the height and one image above the other) that way teh image is already loaded and you simply set the heigh of the container element to half the total image height. on hover shift the image up....

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.