The use of HTML Map-area

Source: Internet
Author: User

Use background

When the setting diagram to the page, often encounter this situation: a small picture has a lot of small icons can be clicked, according to the usual method is to cut out this one of the small figure, and then each add a tag to jump, but this will be a very waste of time, and will increase the number of page pictures, Slow down the loading speed of the page, so let's take this picture as an example, add a map to the top 3 small images.

Use of Map-area

In the IMG tag there is a Usemap attribute, the value is the map ID or name, with the map image form:

Map and area tags

<map name= "MyMap" id= "MyMap" >
<area shape= "rect" coords= "0, 336, 148" href= "http://www.baidu.com" target= "_blank" alt= "Baidu" > <area Shap E= "rect" coords= "370, 0,610, 148" href= "http://www.google.com" target= "_blank" alt= "Google" ></map>
    • Map has the ID and name attribute, it is best to write both the ID and the name attribute, so that there is better compatibility.
    • Area's Shape property, which is a lot of values, the most commonly used are rect (rectangle) and Circ (round)
    • The href attribute of area is the target address that you click to jump to
    • The target and ALT attributes of area, like the <a> attribute, do not say much
    • The Coords property of area, which represents the coordinates of the two points in the upper-left and lower-right corners of the rectangle, we'll consider, for example, how to calculate the coordinates.
Calculate coordinates

First we open Photoshop, I use Photoshop cc, shortcut key ctrl+r (Mac Command+r) to open the ruler

We can go through the position of the red box is the 2 points we need, through the ruler line we can get the corresponding coordinates (75,0,336,148).

Can pass this method can accurately get coordinates, if want to not be particularly accurate to take coordinates, we can through QQ tool to take, here no longer demonstrates!

The use of HTML Map-area

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.