HTML元素map就是圖像映射,就是帶有預先定義區域的圖像,這些區域包含了指向其它文檔或錨的鏈接。例如,你可以在一副太陽系的圖像上創建用戶點擊後可浏覽不同星球的鏈接。
map 對象由 IMG 元素的 USEMAP 屬性引用,格式如下:
MAP 元素包含一組定義圖像中鏈接區域的 AREA 元素。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的腳本中可用。
此元素不會改變顯示。
此元素需要關閉標簽。
An image map is a graphic image, with predefined regions, that contains links to other documents or anchors. For example, you could create an image of the solar system containing links that the user can click to navigate to pages for the individual planets.
The map object is referenced with the USEMAP attribute in an IMG element, as follows:
A MAP element contains a set of AREA elements defining the linking regions in the image.
This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.
This element is not rendered.
This element requires a closing tag.
示例代碼
下面的例子提供了一個太陽系的圖像映射代碼。該代碼在 MAP 元素中使用 AREA 元素及其 COORDS 值和 SHAPE 標簽屬性創建了由圖象映射指向單個行星圖像的鏈接。用戶可以點擊太陽或其它星球來單獨浏覽單個星球的圖像,要返回到太陽系圖像映射,用戶可以單擊後退按鈕。
This example provides the full code for an image map of the solar system. It creates links from the image map to individual images of the planets using the AREA element with the MAP element, COORDS value, and SHAPE attribute. The user clicks the sun or any planet to link to an individual image. To return to the solar system image map, the user clicks the Back button.
以上就是我們給大家介紹的HTML元素map了。希望大家繼續關注我們的網站!