We help IT Professionals succeed at work.
Get Started

Help with displaying sprite images

512 Views
Last Modified: 2012-08-14
Hello all experts.

I have created a sprite image that is made up of three images (pic attached).

The main image is of a car, the second image the same car with the color of the bumper in red and the third image is of the same car with the color of the front grill in red.

I have this CSS that goes with this sprite.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title>Sprites</title>
  <style type="text/css">
    div {
        background: url('result.png');
    }
  </style>
</head>
<body>
  
  
<br /><br /><div style="background-position: -0px -0px; width: 264px; height: 214px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -224px; width: 264px; height: 214px">&nbsp;</div>
<br /><br /><div style="background-position: -0px -448px; width: 264px; height: 214px">&nbsp;</div>
 
 
</body>
</html>

Open in new window



But I have no idea how to implement this.

All I want is when the mouse goes over the bumper of the first main image of the car, it will turn red.  And if the mouse goes over the front-grill of the first main image it will turn red.

Any help will be greatly appreciated.

--d.

Car Sprite
Comment
Watch Question
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE