Reduce the number of HTTP requests using picture maps

Source: Internet
Author: User

Objective

Recently in the "High-performance website construction", record what you learned.

Now many of the Web site is a picture of the navigation, click on the image to jump to the corresponding link. If you have a lot of navigation items, there will be a lot of pictures, and one more HTTP request for each image you need to load. One way to optimize is to use a picture map

label

  Map and area tags are used for image maps

Map tags are used for image mapping of clients; Area tags specify map areas. Good compatibility and can be used with confidence

Chestnuts
  <asideclass= "Container">    <imgsrc= "Src/img_map.png"alt= "Navigation picture"Usemap= "#nav_test">    <Mapname= "Nav_test">      < AreaShape= "Rect"coords= "0 0"href= "https://www.so.com/"Target= "_blank"alt= "360 Search">      < AreaShape= "Rect"coords= "0 212"href= "https://www.baidu.com/"Target= "_blank"alt= "Baidu Search">    </Map>  </aside>

IMG Usename can specify the mappings used, corresponding to the Name property of the map

The shape attribute of area specifies the shapes (default|rect|circle|poly), and the Coords property specifies the region, different shape, the coords format is not the same (pest shape is a rectangle,  coords specifies the coordinates of the upper-left and lower-right corners of the rectangle, in PX. PS: In the HTML4 can also be a percentage, but HTML5 seemingly can only be numeric); href and target, Alt is the same as the a tag.

A picture corresponds to two different links, and there is only one HTTP request, which reduces one request. If there is a lot of navigation, the reduced number of requests will be considerable.

Reduce the number of HTTP requests using picture maps

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.