Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Change a div's background image on hover

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

user-7256

VIP Member
Impact
111
Hi,

I was able to get the background image of a div tag to change on hover in FIREFOX but not in IE.

How can I do this in IE? The code I use is simply:

div.execute:hover {
background-image: url('images/execute2.jpg');
cursor: pointer;
}

I was considering using javascript AS WELL AS this CSS in the case of IE, but would prefer CSS.

How can I do this?

Thanks,
-Matt
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
just try with this example....

<style media="screen" type="text/css">
.menu {
height: 44px;
width: 750px;
position: block;
}

.cssnav {
font-family: arial, helvetica, sans-serif;
white-space: nowrap;
margin: 1px;
padding: 0;
float: left;
}
.cssnav a {
color: #ffffff;
font-size: 12px;
padding-top: 2px;
display: block;
width: 91px;
height: 20px;
background: url(buttons_down.jpg) no-repeat;
text-decoration: none;
font-weight: bold;
text-align: center;
vertical-align: middle;
}
.cssnav a:hover { background: url(buttons_up.jpg); no-repeat; }

</style>

<body>

<div class="menu">
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>

<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
<div class="cssnav"><a href="http://www.mydomain.com" title="1">Button1</a></div>
</body>
 
1
Close
I seen this on CSS Creator. Also, you don't need the semicolon after the url(buttons_up.jpg) in a:hover. There should be a </div> at the end to match the <div class="menu"> as well, but it works without it.
 
0
Close
I'll try that in a little while - thanks!
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back