Solved

Getting hover over to work with image map

Posted on 2007-11-23
4
10,492 Views
Last Modified: 2013-11-19
I have an image map that I am using and would like to allow for a mouseover effect to happen over each link.  Is there a way to make that work using css?  My code is below:



<map name="navbar">
<area shape="poly" coords="246,28,336,28,321,59,231,59" href="#" class="services">
<area shape="poly" coords="338,28,454,28,437,59,323,59" href="#" class="services">
<area shape="poly" coords="455,28,571,28,554,59,439,59" href="#" class="services">
<area shape="poly" coords="572,28,688,28,672,59,556,59" href="#" class="services">
<area shape="poly" coords="691,28,802,28,787,59,674,59" href="#" class="services">
</map>
 
 
 
 
<!--css-->
 
area .services a:hover {
	background				: url(/dev/images/services_hover.png) no-repeat;
}

Open in new window

0
Comment
Question by:pingeyeg
[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
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
TheKyle earned 500 total points
ID: 20344062
If you're ok with dropping the html image map and trying something else, then you could use a "CSS image map".  There's a really good article explaining them here...
http://www.alistapart.com/articles/imagemap/

Basically it involves using the image as a background image of a div and then absolutely positioning all of the anchor tags you need whereever you need them.  Then you can use the a:hover to give the link a background image on hover.
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 20344147
That works for the hover over effect, but not on all resolutions.  Where it is positioned depends on your resolution.  Is there a way to fix that?
0
 
LVL 6

Expert Comment

by:TheKyle
ID: 20344168
It only depends on the resolution/window size if you are positioning the anchor tags relative to the body.  If you make the parent element position: relative, then everything inside of that element will be positioned relative to that.

For example in the following code, the anchor tag will always be 0 pixels from the top and 200 pixels from the left of the navigation UL no matter how big the window is or where the navigation UL is positioned...
...
<ul id="Navigation">
    <li><a href="" title="" class="Item1">Item 1</a></li>
    <li><a href="" title="" class="Item2">Item 2</a></li>
    <li><a href="" title="" class="Item3">Item 3</a></li>
</ul>
...
 
 
 
<!--css-->
#Navigation
{
    position: relative;
    background: url(navimage.jpg);
    height: 50px; width: 600px;
}
#Item1
{
    position: absolute;
    top: 0; left: 200px;
    height: 50px; width: 100px;
}
...

Open in new window

0
 
LVL 1

Author Comment

by:pingeyeg
ID: 20344180
You guys rock!!  Thanks
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Change static entered data to dynamic with counter 5 36
Non-Resizable Pharagraph 2 19
tiled banner 2 13
output in HTML in Powershell 5 28
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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…

733 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