HTML coords-Attribut
Das HTML coords-Attribut gibt die Koordinaten eines Bereichs in der Image-Map an. Um die Form, Größe und Platzierung eines Bereichs festzulegen, wird es zusammen mit dem shape-Attribut verwendet.
Sie können dieses Attribut auf dem <area>-Element verwenden.
Die obere linke Ecke eines Bereichs hat die Koordinaten 0,0.
Das coords-Attribut kann folgende Werte annehmen:
- x1, y1, x2, y2. Gibt die Koordinaten der oberen linken (x1, y1) und unteren rechten (x2, y2) Ecke eines Rechtecks an.
- x, y, radius. Gibt die Koordinaten des Mittelpunkts (x, y) und den Radius (radius) eines Kreises an.
- x1, y1, x2, y2, .., xn, yn. Gibt die Koordinaten eines Polygons an.
Syntax
Syntax des HTML coords-Attributs
css
<area coords="value">Beispiel für das HTML coords-Attribut:
Beispiel für das HTML "coords"-Attribut
html
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p>Click on the logo or on one of the logo item to watch it closer:</p>
<img src="https://de.w3docs.com/uploads/media/news_gallery/0001/01/thumb_316_news_gallery_list.jpeg" width="250" height="150" alt="block" usemap="#blockmap" />
<map name="blockmap">
<area shape="circle" coords="50,32,25" alt="html" href="https://de.w3docs.com/uploads/media/book_gallery/0001/01/d450f0358f947dffb3af91195c3002600d74101b.png" />
<area shape="circle" coords="218,115,25" alt="css" href="https://de.w3docs.com/uploads/media/book_gallery/0001/01/25521e981b34da57c8f51baddc5b76351b855818.png" />
<area shape="circle" coords="195,32,28" alt="php" href="https://de.w3docs.com/uploads/media/book_gallery/0001/01/4bbee6698c4884f25c46010d61b658dd62d2c04f.png" />
<area class="homepage" shape="rect" coords="90,90,35,55" alt="php" href="https://www.w3docs.com/" />
</map>
</body>
</html>Praxis
Welche Funktion hat das 'coords'-Attribut in HTML und wie wird es verwendet?