Unstoppable Domains

Change a div's background image on hover

Spaceship 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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
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
•••
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
•••
I'll try that in a little while - thanks!
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back