2
Well, from my perspective the attribute alt
does not do its job by being assigned to the tag area
I have already done my tests and it does not do its goal, which is to put an alternative text when the image cannot be displayed, for example, in the code below there are several areas mapped in the image, code of my own making.
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><area></title>
<style>
img {
width: 680px;
height: 420px;
}
</style>
</head>
<body>
<img src="https://images.unsplash.com/photo-1516542076529-1ea3854896f2?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ
" usemap="#mapping" alt="Imagem mapeada">
<map name="mapping">
<area shape="poly" coords="230, 44, 244, 140, 485, 139, 517, 44" href="https://en.wikipedia.org/wiki/Computer_monitor" target="_blank" alt="Tela do computador">
<area shape="poly" coords="529, 244, 575, 214, 639, 302, 593, 333" href="https://pt.wikipedia.org/wiki/Smartphone" target="_blank" alt="Telefone inteligente">
<area shape="poly" coords="23, 248, 65, 184, 62, 179, 61, 143, 64, 142, 65, 173, 70, 180, 173, 235, 169, 240, 166, 239, 124, 304" href="https://en.wikipedia.org/wiki/Diary_(stationery)" target="_blank" alt="Agenda">
<area shape="poly" coords="138, 176, 147, 163, 216, 95, 222, 102, 199, 125, 197, 123, 152, 169, 141, 177" href="https://en.wikipedia.org/wiki/Pen" target="_blank" alt="Caneta">
<area shape="circle" coords="210, 319, 17" href="https://en.wikipedia.org/wiki/Clock" target="_blank" alt="Relógio">
<area shape="circle" coords="541, 135, 22" href="https://en.wikipedia.org/wiki/Orange_(fruit)" target="_blank" alt="Laranja">
</map>
</body>
</html>
If the above image cannot be displayed it will sample the contents of alt
that is Imagem mapeada
.
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><area></title>
<style>
img {
width: 680px;
height: 420px;
}
</style>
</head>
<body>
<img src="https://imadges.unsplash.com/photo-1516542076529-1ea3854896f2?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ
" usemap="#mapping" alt="Imagem mapeada">
<map name="mapping">
<area shape="poly" coords="230, 44, 244, 140, 485, 139, 517, 44" href="https://en.wikipedia.org/wiki/Computer_monitor" target="_blank" alt="Tela do computador">
<area shape="poly" coords="529, 244, 575, 214, 639, 302, 593, 333" href="https://pt.wikipedia.org/wiki/Smartphone" target="_blank" alt="Telefone inteligente">
<area shape="poly" coords="23, 248, 65, 184, 62, 179, 61, 143, 64, 142, 65, 173, 70, 180, 173, 235, 169, 240, 166, 239, 124, 304" href="https://en.wikipedia.org/wiki/Diary_(stationery)" target="_blank" alt="Agenda">
<area shape="poly" coords="138, 176, 147, 163, 216, 95, 222, 102, 199, 125, 197, 123, 152, 169, 141, 177" href="https://en.wikipedia.org/wiki/Pen" target="_blank" alt="Caneta">
<area shape="circle" coords="210, 319, 17" href="https://en.wikipedia.org/wiki/Clock" target="_blank" alt="Relógio">
<area shape="circle" coords="541, 135, 22" href="https://en.wikipedia.org/wiki/Orange_(fruit)" target="_blank" alt="Laranja">
</map>
</body>
</html>
Only that the contents of alt
of tags area
are not shown why? in my vision I see the alt
within the tags area
as a name for each area within an image map that serves only as a name to identify that area in the middle of several areas.
@leandrodonascimento vc noticed that the tag
area
does not have a type closing tag</area>
This means that it is an empty element, or void element, so there is no way to have a text inside. Also, when the image does not load your map is not coordinated, because it loses the reference X/Y since the image did not render on the screen.– hugocsl
@leandrodonascimento I am happy to have helped, success ai
– hugocsl