Solved

An imagemap using CSS

Posted on 2016-08-19
2
36 Views
Last Modified: 2016-08-20
I worked on a project a while ago where there were multiple images on a single graphic. But instead of it being a conventional image map, it was a series of <li> tags, each with a class. That class was a dimension, from what I can recall.

In any event, I need to duplicate that approach and I've forgotten how it works. Again, it's a large jpg with several logos on it. Then there were several <li> tags and each <li> was kind of like an image map.

Can anyone point me in the right direction?
0
Comment
Question by:brucegust
2 Comments
 
LVL 6

Accepted Solution

by:
Mikkel Sandberg earned 500 total points
ID: 41762955
It sounds like you're talking about an image sprite. So each <li> would show a different image, correct?
You should be able to use background-image to specify the sprite, and then use background-position to "select" the right image. So the css may look something like this:
li {
  width: 50px;
  height: 50px;
  background-image: url(path/to/image/sprite.jpg);
}
.image1 {
  background-position: 0px 0px; /* tweak these values as needed */
}
.image2 {
  background-position: 0px 10px; /* tweak these values as needed */
}
/* etc etc */

Open in new window


Let me know if I'm way off here :)
0
 

Author Closing Comment

by:brucegust
ID: 41763990
Perfect!

Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now