Learn how to create hyperlinks using the <a> tag with attributes like href, target, and title to connect web pages and resources.
To create an HTML webpage that demonstrates the use of hyperlinks using the <a> tag with attributes like href, target, and title.
Hyperlinks are the foundation of the web. The <a> (anchor) tag is used to create links. Key attributes:
href — Specifies the destination URL or file path.target — Specifies where to open the link (_blank for new tab, _self for same tab).title — Provides additional information (tooltip) on hover.id).
Click the image to visit a website
| Attribute | Purpose | Example |
|---|---|---|
href |
Destination URL or path | href="https://google.com" |
target |
Where to open the link | target="_blank" (new tab), target="_self" (same tab) |
title |
Tooltip text on hover | title="Search the web" |
id |
For linking to a specific section | id="section1" then href="#section1" |
download |
Download the linked file | download="filename.pdf" |
| Type | Description | Example |
|---|---|---|
| External Link | Links to another website | href="https://google.com" |
| Internal Link | Links to another page on the same site | href="about.html" |
| Anchor Link | Links to a section within the same page | href="#section1" |
| Email Link | Opens default email client | href="mailto:info@example.com" |
| Phone Link | Dials a phone number (mobile) | href="tel:+923001234567" |
| Image Link | An image that acts as a link | <a href="..."><img src="..."></a> |
| Download Link | Downloads the linked file | href="file.pdf" download |
| Value | Description | Use Case |
|---|---|---|
_blank |
Opens in a new tab or window | External links (recommended) |
_self |
Opens in the same tab (default) | Internal links |
_parent |
Opens in the parent frame | For framed pages |
_top |
Opens in the full body of the window | For framed pages |
| Mistake | Why It's Wrong | Correct Way |
|---|---|---|
Missing href attribute |
Link won't work | Always include href |
Forgetting http:// or https:// |
Link may try to open as a local file | Use full URL: https://google.com |
Using spaces in href values |
Invalid URL | Use %20 or no spaces |
Not using target="_blank" for external links |
User leaves your site | Use target="_blank" for external links |
Forgetting to close <a> tag |
Invalid HTML | Always close with </a> |
<a> is the anchor tag used for creating hyperlinks.href attribute is required for the link to work.target="_blank" for external links to open in a new tab.title provides a helpful tooltip on hover.mailto:) and phone (tel:).<a> tag.#) allow navigation within the same page.You have successfully:
<a> tag.href, target, and title attributes.href attribute for links. Use target="_blank" for external links to keep users on your site. Use descriptive link text (not "click here") for better accessibility and SEO.
ایک HTML ویب صفحہ بنانا جو ہائپر لنکس کے استعمال کو <a> ٹیگ کے ساتھ href، target، اور title صفات کے ساتھ ظاہر کرتا ہے۔
ہائپر لنکس ویب کی بنیاد ہیں۔ <a> (اینکر) ٹیگ لنکس بنانے کے لیے استعمال ہوتا ہے۔ اہم صفات:
href — منزل کا URL یا فائل پاتھ مخصوص کرتا ہے۔target — لنک کہاں کھلنا ہے مخصوص کرتا ہے (_blank نئی ٹیب کے لیے، _self اسی ٹیب کے لیے)۔title — ہوور پر اضافی معلومات (ٹولٹپ) فراہم کرتا ہے۔id کا استعمال کرتے ہوئے) کی طرف اشارہ کر سکتے ہیں۔
ویب سائٹ ملاحظہ کرنے کے لیے تصویر پر کلک کریں
| صفت | مقصد | مثال |
|---|---|---|
href |
منزل کا URL یا پاتھ | href="https://google.com" |
target |
لنک کہاں کھلنا ہے | target="_blank" (نئی ٹیب)، target="_self" (اسی ٹیب) |
title |
ہوور پر ٹولٹپ متن | title="ویب تلاش کریں" |
id |
کسی مخصوص حصے سے لنک کرنے کے لیے | id="section1" پھر href="#section1" |
download |
لنک شدہ فائل ڈاؤن لوڈ کریں | download="filename.pdf" |
| قسم | وضاحت | مثال |
|---|---|---|
| بیرونی لنک | کسی اور ویب سائٹ کا لنک | href="https://google.com" |
| اندرونی لنک | اسی سائٹ کے کسی اور صفحے کا لنک | href="about.html" |
| اینکر لنک | اسی صفحے کے کسی حصے کا لنک | href="#section1" |
| ای میل لنک | ڈیفالٹ ای میل کلائنٹ کھولتا ہے | href="mailto:info@example.com" |
| فون لنک | فون نمبر ڈائل کرتا ہے (موبائل) | href="tel:+923001234567" |
| تصویری لنک | ایک تصویر جو لنک کا کام کرتی ہے | <a href="..."><img src="..."></a> |
| ڈاؤن لوڈ لنک | لنک شدہ فائل ڈاؤن لوڈ کرتا ہے | href="file.pdf" download |
| قدر | وضاحت | استعمال کی صورت |
|---|---|---|
_blank |
نئی ٹیب یا ونڈو میں کھلتا ہے | بیرونی لنکس (تجویز کردہ) |
_self |
اسی ٹیب میں کھلتا ہے (ڈیفالٹ) | اندرونی لنکس |
_parent |
پیرنٹ فریم میں کھلتا ہے | فریم شدہ صفحات کے لیے |
_top |
ونڈو کے مکمل باڈی میں کھلتا ہے | فریم شدہ صفحات کے لیے |
| غلطی | یہ کیوں غلط ہے | صحیح طریقہ |
|---|---|---|
href صفت غائب |
لنک کام نہیں کرے گا | ہمیشہ href شامل کریں |
http:// یا https:// بھول جانا |
لنک مقامی فائل کے طور پر کھلنے کی کوشش کر سکتا ہے | مکمل URL استعمال کریں: https://google.com |
href اقدار میں اسپیس کا استعمال |
غلط URL | %20 استعمال کریں یا اسپیس نہ استعمال کریں |
بیرونی لنکس کے لیے target="_blank" کا استعمال نہ کرنا |
صارف آپ کی سائٹ چھوڑ دیتا ہے | بیرونی لنکس کے لیے target="_blank" استعمال کریں |
<a> ٹیگ بند کرنا بھول جانا |
غلط HTML | ہمیشہ </a> کے ساتھ بند کریں |
<a> ہائپر لنکس بنانے کے لیے استعمال ہونے والا اینکر ٹیگ ہے۔href صفت لنک کے کام کرنے کے لیے ضروری ہے۔target="_blank" استعمال کریں تاکہ نئی ٹیب میں کھلے۔title ہوور پر مددگار ٹولٹپ فراہم کرتا ہے۔mailto:) اور فون (tel:) سے لنک کر سکتے ہیں۔<a> ٹیگ میں لپیٹ کر کلک کرنے کے قابل بنایا جا سکتا ہے۔#) اسی صفحے کے اندر نیویگیشن کی اجازت دیتے ہیں۔آپ نے کامیابی سے:
<a> ٹیگ کا استعمال کرتے ہوئے ہائپر لنکس کے ساتھ ایک HTML ویب صفحہ بنایا۔href، target، اور title صفات کا استعمال کیا۔href صفت شامل کریں۔ صارفین کو آپ کی سائٹ پر رکھنے کے لیے بیرونی لنکس کے لیے target="_blank" استعمال کریں۔ بہتر رسائی اور SEO کے لیے وضاحتی لنک ٹیکسٹ استعمال کریں ("یہاں کلک کریں" کے بجائے)۔