Master your css layouts with advanced solutions
Home
 
OPTIMIZING YOUR WEBSITE FOR YOUR CSS IMAGE MAPS

 

Image maps allow web developers to specify regions of an image to act as hotspots. Image maps were very popular several years ago, but they are much less common these days. This is partly due to the popularity of Flash, and partly due to the move toward simpler and less presentational markup. While image maps are still a perfectly valid part of HTML, they do mix presentation with content. However, it is possible to create simple image maps with a combination of lists, anchors, and some advanced CSS.

The first thing you need to do is add your image to the page, inside a named div:


<div id="pic">
<img src="images/group-photo.jpg" width="640" height="425" alt="onion and banana" />
</div>


Then, add a list of links to each person’s website after the image. Each list item needs to be given a class to identify the person in that list item. You can also give each link a title attribute containing the name of the person. That way, when the link is hovered over, a tooltip showing who the person is will be displayed on most browsers.


<div id="pic">
<img src="images/group-photo.jpg" width="640" height="425" alt="onion and banana " />
<ul>


The width and height of the div so that it matches the dimensions of the image. Then set the position property of the div to relative. This last step is the key to this technique as it allows the enclosed links to be positioned absolutely, in relation to the edges of the div, and hence the image.

#pic {
width: 640px;
height: 425px;
position: relative; /* The key to this technique */

}


You won’t want the list bullets to display, so remove them by setting the list-style property to none. For completeness you may as well zero down the list’s margin and padding as well:


#pic ul {
margin: 0;
padding: 0;
list-style: none;
}

The next thing to do is style the links. By positioning the anchor links absolutely, they will all be moved to the top-left corner of the containing div. They can then be positioned individually over the correct people, forming the hotspots. However, first you will need to set their widths and heights to create your desired hit area. The link text is still displayed; therefore, it is necessary to hide it off the screen by using a large, negative text indent:


#pic a {
position: absolute;
width: 100px;
height: 120px;
text-indent: -1000em;
}

Lastly, to create the rollover effect, a solid white border is applied to the links when theyare hovered over:

#pic a:hover {
border: 1px solid #fff;
}

Business Loans | Commercial Loans | Residential Loans | Loans
Commercial magnet | the new face of the online lending marketplace where borrowers and lenders connect; 6 points of service to help build your wealth! 

Cpap, Bipap And Portable Oxygen Concentrators
Sleeprestfully. Com is your source for high quality cpap, bilevel, auto cpap, portable oxygen concentrators and obstructive sleep apnea machines that are specifically designed to help you achieve the restful sleep you so rightfully deserve.

Katy Real Estate
We are a home remodeling company located in the city of katy, texas. We perform a range of services from kitchen remodels, bathroom remodeling, interior & exterior house painting, room additions, fencing, siding, roofing and much more.

Vigrx
Slim sweet weight loss at bargin prices! 5 x sachets for 14. 99

Your 3d Design
Want a talking dog for your dog web site? Unique talking 3d characters are a great way to stand out from the crowd. Our customers get inexpensive hosting. Cost effective for small businesses who want a great presence on the web.  

 

 

 

 

 

 

 

 

 

 

 

 



Copyright ADVANCED CSS WEB SOLUTIONS    |   All rights reserved