Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> HTML

HTML <area> href एट्रिब्यूट: इमेज मैप लिंक टारगेट

<area> href एट्रिब्यूट

href एट्रिब्यूट <area> एलिमेंट में हाइपरलिंक टारगेट (लिंक गंतव्य) निर्दिष्ट करता है। यह <a> टैग के href के समान काम करता है लेकिन इमेज मैप के विशिष्ट क्षेत्रों के लिए होता है।

सिंटैक्स

<area href="URL">

URL प्रकार

  • एब्सोल्यूट: https://example.com/page.html
  • रिलेटिव: /html/index.htm, ../page.html
  • एंकर: #section-id
  • प्रोटोकॉल: mailto:email@example.com, tel:+1234567890
  • JavaScript: javascript:void(0) (अनुशंसित नहीं)

उदाहरण: इमेज मैप में तीन लिंक्स

<!DOCTYPE html>
<html>
<body>
  <h2>सीखना</h2>
  <p>इन तकनीकों को आसानी से सीखें....</p>
  <img src="/images/usemap.gif" alt="usemap" border="0" usemap="#tutorials"/>
  <map name="tutorials">
    <area shape="poly" coords="74,0,113,29,98,72,52,72,38,27" 
          href="/perl/index.htm" alt="Perl Tutorial" target="_blank" />
    <area shape="rect" coords="22,83,126,125" alt="HTML Tutorial" 
          href="/html/index.htm" target="_blank" />
    <area shape="circle" coords="73,168,32" alt="PHP Tutorial" 
          href="/php/index.htm" target="_blank" />
  </map>
</body>
</html>

आउटपुट

एक इमेज जिस पर तीन क्लिक करने योग्य क्षेत्र हैं (बहुभुज, आयत, वृत्त), प्रत्येक अलग पेज से लिंक करता है।

कोड व्याख्या

<img src="/images/usemap.gif" alt="usemap" border="0" usemap="#tutorials"/>

<map name="tutorials">
  <area shape="poly" coords="..." href="/perl/index.htm" .../>
  <area shape="rect" coords="..." href="/html/index.htm" .../>
  <area shape="circle" coords="..." href="/php/index.htm" .../>
</map>

shape और coords

shape coords प्रारूप उदाहरण
rectx1,y1,x2,y2कोने: बाएँ,ऊपर,दाएँ,नीचे
circlex,y,radiusकेंद्र x,y और त्रिज्या
polyx1,y1,x2,y2,...बहुभुज के शीर्ष
default(कोई coords नहीं)पूरी इमेज का शेष भाग

एक्सेसिबिलिटी

प्रत्येक <area> में alt एट्रिब्यूट अनिवार्य है (यदि href मौजूद है) - स्क्रीन रीडर्स के लिए क्षेत्र का उद्देश्य वर्णन करता है।

  1. HTML optimum एट्रिब्यूट HTML optimum एट्रिब्यूट

    परिचय HTML optimum एट्रिब्यूट उस रेंज को परिभाषित करता है जहां <meter> एलिमेंट का मान इष्टतम (optimum) माना जाता है। यह केवल <meter> HTML एलिमेंट पर लागू होता है। सिंटैक्स <meter optimum=number></meter> उदाहरण <!DOCTYPE html> <html> <style> body { co

  1. HTML open एट्रिब्यूट HTML open एट्रिब्यूट

    परिचय HTML open एट्रिब्यूट यह निर्दिष्ट करता है कि <details> HTML एलिमेंट की सामग्री उपयोगकर्ता को दृश्यमान (खुली) होनी चाहिए। यह एक बूलियन एट्रिब्यूट है। सिंटैक्स <details open></details> उदाहरण <!DOCTYPE html> <html> <style> body { color: #000; heigh

  1. HTML low एट्रिब्यूट HTML low एट्रिब्यूट

    परिचय HTML low एट्रिब्यूट उस रेंज को परिभाषित करता है जहां <meter> एलिमेंट का मान कम माना जाता है। यह केवल <meter> HTML एलिमेंट पर लागू होता है। सिंटैक्स <meter low=number></meter> उदाहरण <!DOCTYPE html> <html> <style> body { color: #000; height: