This time I will show you how to use map tags and area tags, and what are the precautions for map tags and area tags. The following is a practical case, let's take a look.
The purpose of the map tag: is bound to the img tag and is often used to give a special meaning to a certain area of the client image. , click this area to jump to a new document.
Because the map tag is bound to the img tag, we need to add the ID and name attributes to the map tag, and let the usemap attribute in the img tagQuoteThe id or name attribute in the map tag (due to different browsers, the usemap attribute receives the value of one of the two, so usually both the name and id attributes are written with the same value), and matched with the area tag for use.
The sample code is as follows:
nbsp;html> <img src="/static/imghwm/default1.png" data-src="http://s2.sinaimg.cn/middle/69906822ga1e24ba6e971&690" class="lazy" alt="How to use map tag and area tag" > <map> <area> <area> <area> <area> <area> <area> <area> <area> </map>The display effect is as follows:
We can It can be seen that this is a map. If it is just a picture, it will look very monotonous, so we use the map tag to give meaning to the regions of each province. Here I click on the Xinjiang region and jump to Xinjiang's Baidu Encyclopedia, as shown below:
1, alt Attribute
Definition: Specifies the alternative text of the area.
Note: If you write the href attribute, the alt attribute is required
2. Cooreds attribute
Definition: Define the coordinates of the relevant area
Description: Used with the shape attribute
(1 ) When the shape attribute is rect, it means that the relevant area is a rectangle, and the coordinates attribute value is (x1, y1, x2, y2), where x1, y1 are the coordinates of the upper left corner, and x2, y2 are the coordinates of the lower right corner;
(2) When the shape attribute is circle, it means that the relevant area is a circle, and the coordinates attribute value is (x, y, radius), where x, y are the center coordinates of the circle , radius is the radius of the circle;
(3) When the shape attribute is poly, it means that the relevant area is a polygon, and the cooreds attribute value is (x1,y1,x2,y2, x3,y3......xn,yn), specifies the coordinates of each vertex of the polygon. Since the browser will automatically close the polygon, the tail coordinates do not have to be equal to the first coordinate.
3. href attribute
Definition: Defines the target connected to the relevant area
Note: The href attribute generally has three values
(1) Absolute path: usually used to point to other websites such as (href="https://www.baidu.com" )(2) Relative path: usually used to point to a file within your own website such as (href="//favicon.ico")
(3) Anchor link: usually used to point to the anchor in the page such as (href="#header")
4, shape attribute
Definition: defines the shape of the relevant area
Description: (1) Default value (default): Specifies all areas
(2) RECT: The relevant area is rectangular
This (3) CIRCLE: The relevant area is circular
# This # # Where to open the target link
Instructions: (1)_blank: Open the linked document in a new window
(2)_self: By default, the linked document is opened in the same frame. 4) _top: Open the linked document in the entire window(5) framename: Open the linked document in the specified frame
Description : The area tag can sometimes be used as a substitute for the a tag, because the a tag cannot directly nest the a tag. In some cases, we have to use it, then we can replace the a tag with the area tag to make the layout more beautiful. Simple.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
What are the steps for jest to test react native componentsHow to use js’s custom trim function
The above is the detailed content of How to use map tag and area tag. For more information, please follow other related articles on the PHP Chinese website!

In this post, Blackle Mori shows you a few of the hacks found while trying to push the limits of Cohost’s HTML support. Use these if you dare, lest you too get labelled a CSS criminal.

Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.

Interactive CSS animations with elements ricocheting off each other seem more plausible in 2025. While it’s unnecessary to implement Pong in CSS, the increasing flexibility and power of CSS reinforce Lee's suspicion that one day it will be a

Tips and tricks on utilizing the CSS backdrop-filter property to style user interfaces. You’ll learn how to layer backdrop filters among multiple elements, and integrate them with other CSS graphical effects to create elaborate designs.

Well, it turns out that SVG's built-in animation features were never deprecated as planned. Sure, CSS and JavaScript are more than capable of carrying the load, but it's good to know that SMIL is not dead in the water as previously

Yay, let's jump for text-wrap: pretty landing in Safari Technology Preview! But beware that it's different from how it works in Chromium browsers.

This CSS-Tricks update highlights significant progress in the Almanac, recent podcast appearances, a new CSS counters guide, and the addition of several new authors contributing valuable content.

Most of the time, people showcase Tailwind's @apply feature with one of Tailwind's single-property utilities (which changes a single CSS declaration). When showcased this way, @apply doesn't sound promising at all. So obvio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
