एचटीएमएल <a> टैग
उदाहरण
W3Schools.com के लिए एक लिंक बनाएं:
<a href="https://www.w3schools.com">Visit W3Schools.com!</a>
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
टैग एक हाइपरलिंक को <a>
परिभाषित करता है, जिसका उपयोग एक पृष्ठ से दूसरे पृष्ठ से लिंक करने के लिए किया जाता है।
<a>
तत्व की सबसे महत्वपूर्ण विशेषता
href
विशेषता है, जो लिंक के गंतव्य को इंगित करती है।
डिफ़ॉल्ट रूप से, सभी ब्राउज़रों में लिंक निम्नानुसार दिखाई देंगे:
- एक अनदेखी लिंक रेखांकित और नीला है
- एक विज़िट किया गया लिंक रेखांकित और बैंगनी है
- एक सक्रिय लिंक रेखांकित और लाल है
टिप्स और नोट्स
युक्ति: यदि <a>
टैग में कोई
href
विशेषता नहीं है, तो यह हाइपरलिंक के लिए केवल एक प्लेसहोल्डर है।
युक्ति: एक लिंक किया गया पृष्ठ सामान्य रूप से वर्तमान ब्राउज़र विंडो में प्रदर्शित होता है, जब तक कि आप कोई अन्य लक्ष्य निर्दिष्ट नहीं करते हैं।
युक्ति: लिंक को स्टाइल करने के लिए CSS का उपयोग करें: CSS लिंक और CSS बटन ।
ब्राउज़र समर्थन
Element | |||||
---|---|---|---|---|---|
<a> | Yes | Yes | Yes | Yes | Yes |
गुण
Attribute | Value | Description |
---|---|---|
download | filename | Specifies that the target will be downloaded when a user clicks on the hyperlink |
href | URL | Specifies the URL of the page the link goes to |
hreflang | language_code | Specifies the language of the linked document |
media | media_query | Specifies what media/device the linked document is optimized for |
ping | list_of_URLs | Specifies a space-separated list of URLs to which, when the link is followed, post requests with the body ping will be sent by the browser (in the background). Typically used for tracking. |
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 external help license next nofollow noreferrer noopener prev search tag |
Specifies the relationship between the current document and the linked document |
target | _blank _parent _self _top |
Specifies where to open the linked document |
type | media_type | Specifies the media type of the linked document |
वैश्विक गुण
<a>
टैग HTML में वैश्विक विशेषताओं का भी समर्थन करता है ।
घटना गुण
<a>
टैग HTML में ईवेंट विशेषताओं का भी समर्थन करता है ।
और ज्यादा उदाहरण
उदाहरण
लिंक के रूप में छवि का उपयोग कैसे करें:
<a href="https://www.w3schools.com">
<img border="0" alt="W3Schools"
src="logo_w3s.gif" width="100" height="100">
</a>
उदाहरण
नई ब्राउज़र विंडो में लिंक कैसे खोलें:
<a href="https://www.w3schools.com" target="_blank">Visit W3Schools.com!</a>
उदाहरण
फ़ोन नंबर से कैसे लिंक करें:
<a href="tel:+4733378901">+47 333 78 901</a>
उदाहरण
एक ही पेज पर दूसरे सेक्शन से कैसे लिंक करें:
<a href="#section2">Go to Section 2</a>
उदाहरण
जावास्क्रिप्ट से कैसे लिंक करें:
<a href="javascript:alert('Hello World!');">Execute JavaScript</a>
संबंधित पृष्ठ
एचटीएमएल ट्यूटोरियल: एचटीएमएल लिंक
HTML DOM संदर्भ: एंकर ऑब्जेक्ट
सीएसएस ट्यूटोरियल: स्टाइलिंग लिंक
डिफ़ॉल्ट सीएसएस सेटिंग्स
अधिकांश ब्राउज़र <a>
निम्न डिफ़ॉल्ट मानों के साथ तत्व प्रदर्शित करेंगे:
a:link, a:visited {
color: (internal value);
text-decoration: underline;
cursor: auto;
}
a:link:active, a:visited:active {
color: (internal value);
}