[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

An imagemap using CSS

Posted on 2016-08-19
2
Medium Priority
?
69 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 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