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
https://forums.phpfreaks.com/topic/41104-css-rollovers/
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
https://forums.phpfreaks.com/topic/41104-css-rollovers/#findComment-199374
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
https://forums.phpfreaks.com/topic/41104-css-rollovers/#findComment-199479
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.