HTML <พื้นที่>แท็ก
ตัวอย่าง
แผนผังรูปภาพพร้อมพื้นที่ที่สามารถคลิกได้:
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400"
height="379">
<map name="workmap">
<area shape="rect"
coords="34,44,270,350" alt="Computer" href="computer.htm">
<area
shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area
shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
แท็ ก<area>
กำหนดพื้นที่ภายในแผนผังรูปภาพ (แผนผังรูปภาพคือรูปภาพที่มีพื้นที่ที่สามารถคลิกได้)
<area>
องค์ประกอบจะซ้อนกันอยู่ภายใน
<map>
แท็กเสมอ
หมายเหตุ:แอตทริบิวต์usemap
ใน<img>
เชื่อมโยงกับ แอตทริบิวต์ <map>
ขององค์ประกอบ
name
และสร้างความสัมพันธ์ระหว่างรูปภาพกับแผนที่
รองรับเบราว์เซอร์
Element | |||||
---|---|---|---|---|---|
<area> | Yes | Yes | Yes | Yes | Yes |
คุณลักษณะ
Attribute | Value | Description |
---|---|---|
alt | text | Specifies an alternate text for the area. Required if the href attribute is present |
coords | coordinates | Specifies the coordinates of the area |
download | filename | Specifies that the target will be downloaded when a user clicks on the hyperlink |
href | URL | Specifies the hyperlink target for the area |
hreflang | language_code | Specifies the language of the target URL |
media | media query | Specifies what media/device the target URL is optimized for |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin same-origin strict-origin-when-cross-origin unsafe-url |
Specifies which referrer information to send with the link |
rel | alternate author bookmark help license next nofollow noreferrer prefetch prev search tag |
Specifies the relationship between the current document and the target URL |
shape |
default rect circle poly |
Specifies the shape of the area |
target | _blank _parent _self _top framename |
Specifies where to open the target URL |
type | media_type | Specifies the media type of the target URL |
คุณสมบัติสากล
แท็ ก<area>
ยังสนับสนุน Global Attributes ในHTML
คุณสมบัติของเหตุการณ์
แท็ ก<area>
ยังสนับสนุนแอตทริบิวต์เหตุการณ์ใน HTML
ตัวอย่างเพิ่มเติม
ตัวอย่าง
แผนผังรูปภาพอื่นพร้อมพื้นที่ที่สามารถคลิกได้:
<img src="planets.gif"
width="145" height="126"
alt="Planets"
usemap="#planetmap">
<map
name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
หน้าที่เกี่ยวข้อง
การอ้างอิง HTML DOM: Area Object
การตั้งค่า CSS เริ่มต้น
เบราว์เซอร์ส่วนใหญ่จะแสดง<area>
องค์ประกอบด้วยค่าเริ่มต้นดังต่อไปนี้:
area {
display: none;
}