Introduction to <area>

The <area>tag in an HTML document is used to define specific, clickable regions within an image, enhancing user interaction. It allows web developers to specify the exact location and dimensions of these interactive regions, known as hotspots. By using the <area>tag with the <href attribute>, clicking on a defined area can direct users to a specified URL, trigger a JavaScript function, or initiate another action, providing a versatile tool for creating interactive images.

What is an Image Map?

An <image map>is a single <image>with multiple interactive areas defined, each acting as a separate link or trigger point. These areas are defined using the <area>tag, which specifies the exact coordinates and shape (rectangle, circle, or polygon) of each hotspot. <image map>are particularly useful when you want to create a visual representation where different parts of the <image map>link to different destinations or perform various functions, such as a world map with clickable regions for each country.

Copy to clipboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title of <area> tag</title>
</head>
<body>
<div class="flip-card" onclick="this.classList.toggle('flip')">
    <div class="flip-card-inner">
        <div class="flip-card-front">
            <h2>What is figma?</h2>
            <p>Figma is a cloud-based, collaborative interface design tool that allows users to create, share, and test designs for websites, mobile apps, and other digital products.</p>
            <img src="https://wptavern.com/wp-content/uploads/2018/11/Screen-Shot-2018-11-19-at-8.43.27-PM.png" alt="Front Image" usemap="#front-map">
            <map name="front-map">
                <area shape="rect" coords="50,50,350,150" href="https://www.figma.com" alt="figma">
            </map>
        </div>
        
        <div class="flip-card-back">
            <h2>More Information</h2>
            <img src="https://cdn.sanity.io/images/599r6htc/regionalized/266ec07c0cfe14229530256bb9700e0bce7ff8d4-2400x1260.png?w=1200&q=70&fit=max&auto=format" alt="Back Image" usemap="#back-map">
            <map name="back-map">
                <area shape="circle" coords="200,125,60" href="https://www.figma.com/about" alt="About Us">
                <area shape="poly" coords="100,100,150,200,200,100,150,50" href="https://www.figma.com/contact" alt="Contact Us">
            </map>
            <p>Figma is a collaborative web application for interface design, with additional offline features enabled by desktop applications for macOS and Windows.</p>
            <a href="https://www.figma.com" class="button">Learn More</a>
        </div>
    </div>
</div>
</body>
</html>
Copy to clipboard
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: linear-gradient(to right, rgb(30, 32, 34), rgb(27, 37, 53));
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

* {
    color-scheme: dark;
}

.flip-card {
    background-color: transparent;
    width: 450px;
    height: 550px;
    perspective: 1000px;
    margin: 20px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.flip .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    padding: 40px;
}

.flip-card-front {
    background-image: linear-gradient(to right, rgb(255, 96, 157), rgb(10, 116, 255));
}

.flip-card-back {
    transform: rotateY(180deg);
    background-color: #1a73e8;
    color: #ffffff;
}

h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.flip-card-back h2 {
    color: #ffffff;
}

p {
    font-size: 1.1em;
    line-height: 1.8;
    margin-bottom: 20px;
}

.flip-card-back p {
    text-align: left;
    color: #e8e8e8;
}

.flip-card img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button {
    display: inline-block;
    padding: 12px 25px;
    font-size: 1em;
    color: #ffffff;
    background-color: #1558b3;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.button:hover {
    background-color: #103d7a;
    transform: translateY(-3px);
}

Global Attributes

AttributesDescription
accesskeySpecifies a shortcut key to activate or focus an element.
autocapitalizeControls whether and how text input is automatically capitalized.
classSpecifies one or more class names for the element, allowing CSS styling and JavaScript manipulation.
contenteditableSpecifies whether the content of an element is editable or not.
contextmenuSpecifies a context menu for the element.
dirDefines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto".
draggableSpecifies whether an element is draggable. Possible values are "true" or "false".
enterkeyhintSpecifies the action label or icon to be shown for the enter key on virtual keyboards.
hiddenIndicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set.
idSpecifies a unique identifier for the element.
inputmodeProvides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants.
isAllows you to specify the type of custom element.
langSpecifies the language of the element's content.
nonceA cryptographic nonce ("number used once") that can be used by Content Security Policy (CSP) to determine whether or not a given fetch will be allowed to proceed.
partSpecifies the element’s part in the shadow DOM.
slotAssigns a slot in a shadow DOM shadow tree.
spellcheckIndicates whether the element is subject to spell checking.
styleProvides inline CSS styling for the element.
tabindexSpecifies the tab order of the element.
titleAdds extra information about the element, displayed as a tooltip when hovering over the element.
translateSpecifies whether the content of the element should be translated. Possible values are "yes" or "no".
HTML AttributesGlobal AttributesEvent Attributes
To view the full list
To view the full list
To view the full list
elementsChrome BrowsersMicrosoft Edge BrowserFirefox BrowsersSafari BrowserOpera Browser
<area>YesYesYesYesYes