- HTML Tag
- Browser Support
- Attributes
- Global Attributes
- Event Attributes
- More Examples
- Example
- Related Pages
- Default CSS Settings
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- HTML Image Maps
- Image Maps
- Example
- How Does it Work?
- The Image
- Create Image Map
- The Areas
- Shape
- Shape=»rect»
- Example
- Shape=»circle»
- Example
- Shape=»poly»
- Example
- Image Map and JavaScript
- Example
- Chapter Summary
- HTML Image Tags
- How to Embed a Google Map in HTML
- Getting the Google Map Code
- Embedding the Google Map Code
- Expert Q&A
- Tips
- You Might Also Like
- Google Maps Tutorial
- Google Maps in HTML
- Example
- My First Google Map
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
HTML Tag
The tag is used to define an image map. An image map is an image with clickable areas.
Browser Support
Attributes
Global Attributes
Event Attributes
More Examples
Example
Another image map, with clickable areas:
usemap=»#planetmap»>
Related Pages
Default CSS Settings
Most browsers will display the element with the following default values:
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
HTML Image Maps
With HTML image maps, you can create clickable areas on an image.
Image Maps
The HTML tag defines an image map. An image map is an image with clickable areas. The areas are defined with one or more tags.
Try to click on the computer, phone, or the cup of coffee in the image below:
Example
Here is the HTML source code for the image map above:
How Does it Work?
The idea behind an image map is that you should be able to perform different actions depending on where in the image you click.
To create an image map you need an image, and some HTML code that describes the clickable areas.
The Image
The image is inserted using the tag. The only difference from other images is that you must add a usemap attribute:
The usemap value starts with a hash tag # followed by the name of the image map, and is used to create a relationship between the image and the image map.
Tip: You can use any image as an image map!
Create Image Map
The element is used to create an image map, and is linked to the image by using the required name attribute:
The name attribute must have the same value as the ‘s usemap attribute .
The Areas
Then, add the clickable areas.
A clickable area is defined using an element.
Shape
You must define the shape of the clickable area, and you can choose one of these values:
- rect — defines a rectangular region
- circle — defines a circular region
- poly — defines a polygonal region
- default — defines the entire region
You must also define some coordinates to be able to place the clickable area onto the image.
Shape=»rect»
The coordinates for shape=»rect» come in pairs, one for the x-axis and one for the y-axis.
So, the coordinates 34,44 is located 34 pixels from the left margin and 44 pixels from the top:
The coordinates 270,350 is located 270 pixels from the left margin and 350 pixels from the top:
Now we have enough data to create a clickable rectangular area:
Example
This is the area that becomes clickable and will send the user to the page «computer.htm»:
Shape=»circle»
To add a circle area, first locate the coordinates of the center of the circle:
Then specify the radius of the circle:
Now you have enough data to create a clickable circular area:
Example
This is the area that becomes clickable and will send the user to the page «coffee.htm»:
Shape=»poly»
The shape=»poly» contains several coordinate points, which creates a shape formed with straight lines (a polygon).
This can be used to create any shape.
Like maybe a croissant shape!
How can we make the croissant in the image below become a clickable link?
We have to find the x and y coordinates for all edges of the croissant:
The coordinates come in pairs, one for the x-axis and one for the y-axis:
Example
This is the area that becomes clickable and will send the user to the page «croissant.htm»:
Image Map and JavaScript
A clickable area can also trigger a JavaScript function.
Add a click event to the element to execute a JavaScript function:
Example
Here, we use the onclick attribute to execute a JavaScript function when the area is clicked:
Chapter Summary
- Use the HTML element to define an image map
- Use the HTML element to define the clickable areas in the image map
- Use the HTML usemap attribute of the
element to point to an image map
HTML Image Tags
Tag | Description |
---|---|
Defines an image | |
Defines an image map | |
Defines a clickable area inside an image map | |
Defines a container for multiple image resources |
For a complete list of all available HTML tags, visit our HTML Tag Reference.
How to Embed a Google Map in HTML
This article was co-authored by wikiHow staff writer, Darlene Antonelli, MA. Darlene Antonelli is a Technology Writer and Editor for wikiHow. Darlene has experience teaching college courses, writing technology-related articles, and working hands-on in the technology field. She earned an MA in Writing from Rowan University in 2012 and wrote her thesis on online communities and the personalities curated in such communities.
This article has been viewed 20,115 times.
Having a map of the area you are talking about on your website might be extremely useful. This wikiHow will show you how to embed a Google Map in HTML.
Getting the Google Map Code
Go to the location you want to share at https://www.google.com/maps. This will open a map specifically within Google Maps.
Click Share or embed map . You might see “Link to this map” instead. This option is toward the bottom of the menu. [1] X Research source
Select the size of the map you want. Next to the field of text, you’ll see SMALL, MEDIUM, LARGE, or CUSTOM SIZE. Click the small arrow pointing down to change the map size.
Copy the text provided. You can use the keyboard shortcuts Ctrl + C (Windows) or ⌘ Cmd + C (Mac) to copy the text. On a mobile device, you can long-tap the text for the “Select all” and “Copy” options.
Embedding the Google Map Code
Open your HTML. You could use a program like Dreamweaver or use a simple word-processing app like Notepad and TextEdit in which you edit your HTML file.
Navigate to where you want to embed the Google Map code. In applications like Dreamweaver, you can see what the code translates into on a web page, so you can easily navigate through the HTML code. Without those applications, you will need to know where you are on the web page by looking at the code.
Paste the Google Maps code. You can use keyboard shortcuts by pressing Ctrl + P (Windows) or ⌘ Cmd + P (Mac). On a mobile device, you can long-tap the text field and tap “Paste” when the option appears.
Expert Q&A
Tips
You Might Also Like
When Will a Google Street View Car Come to Your Area?
Find Latitude and Longitude in Google Maps: Mobile & Desktop
2 Easy Ways to Add a Location or Business to Google Maps
How to Track Someone’s Location in Google Maps
Go Back in Time on Google Maps: See Historical Location Pictures
How to Add Your Business to Google Maps
2 Ways to Change the Voice on Google Maps
How to Download a Photo from Google Maps
How to Type GPS Coordinates into Google Maps: Desktop & Mobile
Get Walking Directions on Google Maps: A Complete Guide
How to Add a Marker in Google Maps
Google Maps Tutorial
This tutorial is about the Google Maps API (Application Programming Interface).
An API is a set of methods and tools that can be used for building software applications.
Google Maps in HTML
This example creates a Google Map in HTML:
Example
My First Google Map
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.