Course Content
HTML Forms
HTML forms are an essential part of web development and provide a way for users to input and submit data to a server. Forms allow users to enter data such as text, numbers, checkboxes, radio buttons, and more. When a user submits a form, the data is typically sent to a server for further processing.
0/6
HTML Graphics
HTML provides various ways to incorporate graphics into web pages.
0/2
HTML Media
HTML provides built-in support for embedding and displaying various types of media content on web pages.
0/5
HTML APIs
HTML APIs, also known as browser APIs or web APIs, are a set of interfaces and methods provided by web browsers to interact with and manipulate web content, access device features, and perform various tasks. These APIs are implemented in JavaScript and are accessible to web developers when creating web applications. Here are some commonly used HTML APIs:
0/5
HTML Examples
Creating a Simple Web Page, Adding Links and Images and more
0/4
HTML5 for Free | HTML5 – Unleashing the Potential of Web Development
About Lesson

HTML image maps allow you to create clickable areas on an image, where each area corresponds to a different link or action. Image maps are defined using the <map> and <area> tags in HTML. Here’s how you can create image maps:

  1. Create an Image:
    First, add an <img> tag to insert the image you want to use for the image map. Set the src attribute to the path or URL of the image.

Example:

<img src="path/to/image.jpg" alt="Description of the image" usemap="#my-map">
  1. Define the Map:
    Next, define the map element using the <map> tag and give it a name attribute. The name value is used to link the map to the image.

Example:

<map name="my-map">
  <!-- Define clickable areas using <area> tags -->
</map>
  1. Define Clickable Areas:
    Within the <map> tag, define clickable areas using the <area> tag. Each <area> tag represents a specific clickable region on the image.

Example:

<map name="my-map">
  <area shape="rect" coords="x1,y1,x2,y2" href="destination1.html" alt="Description of Area 1">
  <area shape="circle" coords="x,y,radius" href="destination2.html" alt="Description of Area 2">
  <area shape="poly" coords="x1,y1,x2,y2,x3,y3,..." href="destination3.html" alt="Description of Area 3">
</map>

The <area> tag has different shape attributes to define the shape of the clickable area: rect (rectangle), circle (circle), and poly (polygon). The coords attribute specifies the coordinates of the shape. The href attribute specifies the destination URL or action associated with the area, and the alt attribute provides alternative text for accessibility.

  1. Linking the Image and Map:
    To link the image and map, add the usemap attribute to the <img> tag and set it to the name of the map preceded by a # symbol.

Example:

<img src="path/to/image.jpg" alt="Description of the image" usemap="#my-map">
<map name="my-map">
  <!-- Define clickable areas using <area> tags -->
</map>

Now, the image areas defined by the <area> tags will be clickable and will navigate to the specified destinations when clicked.

Note: The coords attribute values represent the coordinates of the clickable areas on the image. The actual values depend on the shape of the area and the dimensions of the image.

Image maps provide a way to create interactive and complex clickable regions on images. They are useful for creating navigation menus, diagrams, and other interactive elements.

Join the conversation