Vyoms OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
Bookmark and Share Rss Feeds

How to Create an Image Map Using CSS | Articles | Recent Articles | News Article | Interesting Articles | Technology Articles | Articles On Education | Articles On Corporate | Company Articles | College Articles | Articles on Recession
Sponsored Ads
Hot Jobs
Fresher Jobs
Experienced Jobs
Government Jobs
Walkin Jobs
Placement Section
Company Profiles
Interview Questions
Placement Papers
Resources @ VYOMS
Companies In India
Consultants In India
Colleges In India
Exams In India
Latest Results
Notifications In India
Call Centers In India
Training Institutes In India
Job Communities In India
Courses In India
Jobs by Keyskills
Jobs by Functional Areas
Learn @ VYOMS
GATE Preparation
GRE Preparation
GMAT Preparation
IAS Preparation
SAP Preparation
Testing Preparation
MBA Preparation
News @ VYOMS
Freshers News
Job Articles
Latest News
India News Network
Interview Ebook
Get 30,000+ Interview Questions & Answers in an eBook.
Interview Success Kit - Get Success in Job Interviews
  • 30,000+ Interview Questions
  • Most Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades

VYOMS TOP EMPLOYERS

Wipro Technologies
Tata Consultancy Services
Accenture
IBM
Satyam
Genpact
Cognizant Technologies

Home » Articles » How to Create an Image Map Using CSS

How to Create an Image Map Using CSS








Article Posted On Date : Sunday, September 12, 2010


How to Create an Image Map Using CSS
Advertisements

Introduction

An image map is a way of defining multiple clickable link areas (hotspots) within one image. These 'hotspots' can then used for navigation or to display information about the image they cover.

In this article you will learn how to turn an ordinary defination list into an image map using nothing more than CSS, and what's more, it should work in all modern browsers, including Internet Explorer 5.5.

Here, you will learn one styling step at a time, fully explaining the reason for each style and showing the results of each step, so that you can see what to expect and implement it for yourself.

Method

The following steps will describe how to add images to the definition list and style the text so that it only shows when specific areas of the main image are selected.

Step 1

My example Definition List starts out as a list of Beatles names (they come from my era so it seems a suitable choice), their instruments and a piece of trivia information. The (x)html is written as follows.

<dl>
<dt>
The Beatles
</dt>
<dd>
Paul McCartney - Bass Guitar and Vocals
<br />
<br />
Paul McCartney's song, Yesterday, recently
voted the most popular song of the century
by a BBC poll, was initially composed without
lyrics. Paul used the working title 'scrambled eggs'
before coming up with the final words.
</dd>
<dd>
Ringo Starr - Drums
<br />
<br />
Dear Prudence was written by John and Paul
about Mia Farrow's sister, Prudence, when
she wouldn't come out and play with Mia and
the Beatles at a religious retreat in India.
</dd>
<dd>
John Lennon - Guitar and Vocals
<br />
<br />
In 1962, The Beatles won the Mersyside Newspaper's
biggest band in Liverpool contest principally
because they called in posing as different people
and voted for themselves numerous times.
</dd>
<dd>
George Harrison - Lead Guitar and Vocals
<br />
<br />
The Beatles' last public concert was held in
San Francisco's Candlestick Park on August 29, 1966.
</dd>
</dl>

Because there are four Beatles I will need to define four 'hotspots,' but you can have as many as you like since the technique is the same.

In order that to style this list we need to add information that will enable us to target specific elements.

<dl id="imap">
<dt>
<a id="title" href="#nogo" title="The Beatles">
The Beatles
</a>
</dt>
<dd id="picp">
<a id="paul" title="Paul McCartney" href="#nogo">
<span>
Paul McCartney - Bass Guitar and Vocals
<br />
<br />
Paul McCartney's song, Yesterday, recently
voted the most popular song of the century
by a BBC poll, was initially composed without
lyrics. Paul used the working title 'scrambled eggs'
before coming up with the final words.
</span>
</a>
</dd>
<dd id="picr">
<a id="ringo" title="Ringo Starr" href="#nogo">
<span>
Ringo Starr - Drums
<br />
<br />
Dear Prudence was written by John and Paul
about Mia Farrow's sister, Prudence, when
she wouldn't come out and play with Mia and
the Beatles at a religious retreat in India.
</span>
</a>
</dd>
<dd id="picj">
<a id="john" title="John Lennon" href="#nogo">
<span>
John Lennon - Guitar and Vocals
<br />
<br />
In 1962, The Beatles won the Mersyside Newspaper's
biggest band in Liverpool contest principally
because they called in posing as different people
and voted for themselves numerous times.
</span>
</a>
</dd>
<dd id="picg">
<a id="george" title="George Harrison" href="#nogo">
<span>
George Harrison - Lead Guitar and Vocals
<br />
<br />
The Beatles' last public concert was held in
San Francisco's Candlestick Park on August 29, 1966.
</span>
</a>
</dd>
</dl>

I have added the following style information to the (x)html.

  1. id="imap" - to the dl tag so that we can define it's size to hold the main image.
  2. <a id="title" href="#nogo" title="The Beatles"> ... </a> - Because Internet Explorer will only accept the :hover pseudo class on links, we need to surround the dt text with this link and give it an id="title". I have used href="#nogo" instead of the usual href="#" so that anyone clicking the link will not jump to the top of the page (just make sure you do not have an anchor #nogo on your page). The title="The Beatles" has been added so that it will appear when the mouse is hovered over the main image.
  3. Each dd has been given a unique id so that we can style each one.
  4. Each dd text has been surrounded by a link for the same reason as with (2) above. These links have a unique id so that they can be individually targeted and a title as with (2) above.
  5. Each dd text has also been enclosed in a span so that we can manipulate the text separately from the link.

 






Sponsored Ads



Interview Questions
HR Interview Questions
Testing Interview Questions
SAP Interview Questions
Business Intelligence Interview Questions
Call Center Interview Questions

Databases

Clipper Interview Questions
DBA Interview Questions
Firebird Interview Questions
Hierarchical Interview Questions
Informix Interview Questions
Microsoft Access Interview Questions
MS SqlServer Interview Questions
MYSQL Interview Questions
Network Interview Questions
Object Relational Interview Questions
PL/SQL Interview Questions
PostgreSQL Interview Questions
Progress Interview Questions
Relational Interview Questions
SQL Interview Questions
SQL Server Interview Questions
Stored Procedures Interview Questions
Sybase Interview Questions
Teradata Interview Questions

Microsof Technologies

.Net Database Interview Questions
.Net Deployement Interview Questions
ADO.NET Interview Questions
ADO.NET 2.0 Interview Questions
Architecture Interview Questions
ASP Interview Questions
ASP.NET Interview Questions
ASP.NET 2.0 Interview Questions
C# Interview Questions
Csharp Interview Questions
DataGrid Interview Questions
DotNet Interview Questions
Microsoft Basics Interview Questions
Microsoft.NET Interview Questions
Microsoft.NET 2.0 Interview Questions
Share Point Interview Questions
Silverlight Interview Questions
VB.NET Interview Questions
VC++ Interview Questions
Visual Basic Interview Questions

Java / J2EE

Applet Interview Questions
Core Java Interview Questions
Eclipse Interview Questions
EJB Interview Questions
Hibernate Interview Questions
J2ME Interview Questions
J2SE Interview Questions
Java Interview Questions
Java Beans Interview Questions
Java Patterns Interview Questions
Java Security Interview Questions
Java Swing Interview Questions
JBOSS Interview Questions
JDBC Interview Questions
JMS Interview Questions
JSF Interview Questions
JSP Interview Questions
RMI Interview Questions
Servlet Interview Questions
Socket Programming Interview Questions
Springs Interview Questions
Struts Interview Questions
Web Sphere Interview Questions

Programming Languages

C Interview Questions
C++ Interview Questions
CGI Interview Questions
Delphi Interview Questions
Fortran Interview Questions
ILU Interview Questions
LISP Interview Questions
Pascal Interview Questions
Perl Interview Questions
PHP Interview Questions
Ruby Interview Questions
Signature Interview Questions
UML Interview Questions
VBA Interview Questions
Windows Interview Questions
Mainframe Interview Questions


Copyright © 2001-2024 Vyoms.com. All Rights Reserved. Home | About Us | Advertise With Vyoms.com | Jobs | Contact Us | Feedback | Link to Us | Privacy Policy | Terms & Conditions
Placement Papers | Get Your Free Website | IAS Preparation | C++ Interview Questions | C Interview Questions | Report a Bug | Romantic Shayari | CAT 2024

Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |


Copyright ©2001-2024 Vyoms.com, All Rights Reserved.
Disclaimer: VYOMS.com has taken all reasonable steps to ensure that information on this site is authentic. Applicants are advised to research bonafides of advertisers independently. VYOMS.com shall not have any responsibility in this regard.