Movatterモバイル変換


[0]ホーム

URL:


  1. Веб-технологии для разработчиков
  2. HTML
  3. Справка по HTML
  4. Элемент
  5. <area>

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

<area>

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since июль 2015 г..

* Some parts of this feature may have varying levels of support.

HTML-элемент<area> определяет область внутри карты изображения, в которой есть предварительно определённые области, доступные для кликов.Карта изображения позволяет связывать геометрические области изображения сгипертекстовыми ссылками.

Этот элемент используется только внутри элемента<map>.

Интерактивный пример

<map name="infographic">  <area    shape="poly"    coords="129,0,260,95,129,138"    href="https://developer.mozilla.org/docs/Web/HTTP"    alt="HTTP" />  <area    shape="poly"    coords="260,96,209,249,130,138"    href="https://developer.mozilla.org/docs/Web/HTML"    alt="HTML" />  <area    shape="poly"    coords="209,249,49,249,130,139"    href="https://developer.mozilla.org/docs/Web/JavaScript"    alt="JavaScript" />  <area    shape="poly"    coords="48,249,0,96,129,138"    href="https://developer.mozilla.org/docs/Web/API"    alt="Web APIs" />  <area    shape="poly"    coords="0,95,128,0,128,137"    href="https://developer.mozilla.org/docs/Web/CSS"    alt="CSS" /></map><img  usemap="#infographic"  src="/shared-assets/images/examples/mdn-info.png"  alt="MDN infographic" />
img {  display: block;  margin: 0 auto;  width: 260px;  height: 260px;}
Категории содержимогоЭлементы потока,фразового контента.
Допустимое содержимоеНет, этопустой элемент.
Пропуск теговОткрывающий тег обязателен, закрывающего быть не должно.
Допустимые родителиЛюбой элемент, допускающийфразовый контент. У элемента<area> должен быть родитель<map>, но он не должен быть прямым родителем.
Допустимые ARIA-ролиНет
DOM-интерфейсHTMLAreaElement

Атрибуты

Этот элемент включает в себя толькоглобальные атрибуты.

alt

С помощью этого атрибута задаётся альтернативный текст, описывающий изображение, если оно не доступно. Он должен быть сформулирован так, чтобы предоставить пользователю тот же выбор, что и изображение, которое отрисуется без альтернативного текста. В HTML4 данный атрибут обязателен, но так же может содержать и пустую строку (""). В HTML5 этот атрибут обязателен только при наличии атрибутаhref.

coords

Задаёт значения координат для активной области. Значение и количество значений зависят от значения указанного для атрибутаshape. Дляrect или прямоугольника задаются две пары значений x,ycoords: лево, верх, право и низ. Дляcircle, значенияx,y,r гдеx,y координаты центра круга, аr радиус. Дляpoly или многоугольника, значения задаются парой x и y для каждой вершины многоугольника:x1,y1,x2,y2,x3,y3, и т.д. В HTML4 значения задаются в пикселях или процентах, когда добавлен знак (%); в HTML5, значения — величины в пикселях.

download

Этот атрибут, если он добавлен, указывает, что ссылка используется для скачивания файла. Смотри<a> для полного описания атрибутаdownload.

href

Ссылка для активной области. Это значение действующего URL. В HTML4, этот илиnohref атрибут обязательный. В HTML5, данный атрибут можно пропустить при условии, что активная область не является ссылкой.

hreflang

Указывает язык связанного ресурса. Допустимые значения определяютсяBCP47. Используйте данный атрибут при наличии атрибутаhref.

name

Определяет имя интерактивной области, чтобы оно могло прописаться в старых браузерах.

media

A hint of the media for which the linked resource was designed, for exampleprint and screen. If omitted, it defaults toall. Use this attribute only if thehref attribute is present.

nohref

Indicates that no hyperlink exists for the associated area. Either this attribute or thehref attribute must be present in the element.

referrerpolicyЭкспериментальная возможность

A string indicating which referrer to use when fetching the resource:

  • "no-referrer" meaning that theReferer: header will not be sent.
  • "no-referrer-when-downgrade" meaning that noReferer: header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent's default behavior, if no policy is otherwise specified.
  • "origin" meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port.
  • "origin-when-cross-origin" meaning that navigations to other origins will be limited to the scheme, the host and the port, while navigations on the same origin will include the referrer's path.
  • "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe because it can leak origins and paths from TLS-protected resources to insecure origins.
rel

For anchors containing thehref attribute, this attribute specifies the relationship of the target object to the link object. The value is a space-separated list oflink types values. The values and their semantics will be registered by some authority that might have meaning to the document author. The default relationship, if no other is given, is void. Use this attribute only if thehref attribute is present.

shape

The shape of the associated hot spot. The specifications for HTML 5 and HTML 4 define the valuesrect, which defines a rectangular region;circle, which defines a circular region;poly, which defines a polygon; anddefault, which indicates the entire region beyond any defined shapes. Many browsers, notably Internet Explorer 4 and higher, supportcirc,polygon, andrectangle as valid values forshape; these values areНе стандартно.

tabindex

A numeric value specifying the position of the defined area in the browser tabbing order. This attribute is global in HTML5.

target

This attribute specifies where to display the linked resource. In HTML4, this is the name of, or a keyword for, a frame. In HTML5, it is a name of, or keyword for, abrowsing context (for example, tab, window, or inline frame). The following keywords have special meanings:

  • _self: Load the response into the same HTML4 frame (or HTML5 browsing context) as the current one. This value is the default if the attribute is not specified.
  • _blank: Load the response into a new unnamed HTML4 window or HTML5 browsing context.
  • _parent: Load the response into the HTML4 frameset parent of the current frame or HTML5 parent browsing context of the current one. If there is no parent, this option behaves the same way as_self.
  • _top: In HTML4: Load the response into the full, original window, canceling all other frames. In HTML5: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as_self.Use this attribute only if thehref attribute is present.
type

This attribute specifies the media type in the form of a MIME type for the link target. Generally, this is provided strictly as advisory information; however, in the future a browser might add a small icon for multimedia types. For example, a browser might add a small speaker icon when type is set to audio/wav. For a complete list of recognized MIME types, seehttps://www.w3.org/TR/html4/references.html#ref-MIMETYPES. Use this attribute only if thehref attribute is present.

Пример

html
<map name="primary">  <area    shape="circle"    coords="75,75,75"    href="left.html"    alt="Click to go Left" />  <area    shape="circle"    coords="275,75,75"    href="right.html"    alt="Click to go Right" /></map><img usemap="#primary" src="http://placehold.it/350x150" alt="350 x 150 pic" />

Результат

Notes

Under the HTML 3.2, 4.0, and 5 specifications, the closing tag</area> is forbidden.

The XHTML 1.0 specification requires a trailing slash:<area />.

Theid,class, andstyle attributes have the same meaning as the core attributes defined in the HTML 4 specification, but only Netscape and Microsoft define them.

Netscape 1–level browsers do not understand thetarget attribute as it relates to frames.

HTML 3.2 defines onlyalt,coords,href,nohref, andshape.

HTML 5.1defines obsolete the attributetype on this tag.

Спецификации

Specification
HTML
# the-area-element

Совместимость с браузерами

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp