Solved

An imagemap using CSS

Posted on 2016-08-19
2
55 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses four methods for overlaying images in a container on a web page
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

724 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