Use image map to reduce the number of HTTP requests,

Source: Internet
Author: User

Use image map to reduce the number of HTTP requests,
Preface

I recently read "high-performance website construction" to record what I learned.

Currently, many websites use image navigation. Click images to jump to the corresponding link. If there are many navigation items, there will be a large number of images, and each time an image needs to be loaded, there will be an additional HTTP request. One of the optimization methods is to use the image map.

Tag

  Map and area labels are used for image maps.

The map tag is used to map images on the client. The area tag specifies the ing area. Good compatibility and easy to use

Chestnuts
<Aside class = "container">  <map name = "nav_test"> <area shape = "rect" coords = "0 0 300 110" href = "https://www.so.com/" target = "_ blank" alt = "360 search"> <area shape = "rect" coords = "0 110 300 212" href = "https://www.baidu.com/" target = "_ blank" alt = "Baidu search"> </map> </aside>

The usename of img can specify the ing used, which corresponds to the name attribute of map.

The shape attribute of the area specifies the shape (default | rect | circle | poly). The coords attribute specifies the region. The coords format varies with the shape (the shape in the chestnut is a rectangle, coords specifies the coordinates in the upper left corner and lower right corner of the rectangle, in px. ps: The percentage can also be used in html4, but html5 seems to be only numerical values); href and target, alt are the same as a tag.

 

An image corresponds to two different links, but only one http request reduces one request. In many cases, the number of dropped requests is considerable.

 

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.