tag href dalam HTML
HTML href disingkatkan sebagai rujukan hiperteks. Ini ialah atribut yang tersedia dalam teg sauh (). href ini digunakan untuk URL tapak web seperti www.google.com, www.gmail.com, www.facebook.com dll.
Contoh Masa Nyata: Kehidupan seharian, kami telah mengakses begitu banyak tapak web. Pernahkah anda berfikir tentang bagaimana kami akan mengakses url laman web ini? Kerana teg href, kami boleh mengakses mana-mana URL tapak web. Kami hanya memerlukan tapak web dalam petikan berganda ini (href=”laman web”) bagi atribut href.
Bagaimana Atribut href Berfungsi dalam HTML?
Atribut href HTML berfungsi berdasarkan tag href yang kami gunakan. Semua tujuan tag href yang tersedia adalah sama untuk mengakses URL web, tetapi terdapat sedikit perbezaan.
Terdapat 4 teg yang membenarkan atribut href di dalamnya. Mereka ialah:
1. : Teg ini digunakan untuk menentukan URL halaman di mana pautan perlu pergi dalam atribut href.
Sintaks:
<a href="URL%20link"></a>
2.
Sintaks:
<area href="URL%20link">
3.
Sintaks:
<base href="Base%20URL%20link">
4.
Sintaks:
<link href="external%20link">
Contoh untuk Melaksanakan teg href dalam HTML
Di bawah ialah contoh yang berbeza:
Contoh #1 – tag dengan href Atribut
Kod:
<title>href attribute</title> <!--CSS code--> <style> p { color: green; border: 2px solid brown; font-size: 22px; } h1 { color: blue; text-align: center; } </style> <h1>The <a> tag with href attribute introduction</a> </h1> <p>HTML href is abbreviated as hypertext reference. This is the attribute which is available inside the anchor (<a>) tag. This href is used for website URLs like www.google.com, www.gmail.com, www.facebook.com etc.</a></p> <p>Real time Example: Day to day life we have accessed so many websites. Have you ever think about how would we access this website URLs? Because of href tag we can access any website URLs. We simply required website within this double quotes (href="website") of href attribute. </p> <h1>The <a> tag with href attribute URLs</a> </h1>
Output:
Contoh #2 – tag dengan href Atribut
Kod:
<title>href attribute</title> <!--CSS code--> <style> p { color: fuchsia; border: 2px solid orange; font-size: 22px; } h1 { color: red; text-align: center; } </style> <h1>The <a> tag with href attribute introduction</a> </h1> <p>HTML href is abbreviated as hypertext reference. This is the attribute which is available inside the anchor (<a>) tag. This href is used for website URLs like www.google.com, www.gmail.com, www.facebook.com etc.</a></p> <p>Real time Example: Day to day life we have accessed so many websites. Have you ever think about how would we access this website URLs? Because of href tag we can access any website URLs. We simply required website within this double quotes (href="website") of href attribute. </p> <h1 id="The-area-tag-with-href-attribute-URLs-Example">The <area> tag with href attribute URLs Example</h1> <img src="/static/imghw/default1.png" data-src="planets.gif" class="lazy" style="max-width:90%" style="max-width:90%" alt="tag href dalam HTML" usemap="#educba"> <map name="educba"> <!--Click on this coordinate gives you that images--> <area shape="rect" coords="0,0,81,125" href="sun.htm"> <area shape="circle" coords="91,59,4" href="mercur.htm"> <area shape="circle" coords="125,59,9" href="venus.htm"> </map>
Output:
Selepas Klik
Contoh #3 – tag dengan href Atribut
Kod:
<title>href attribute</title> <!--From this path image is loaded--> <base href="https://www.w3schools.com/images/"> <!--CSS code--> <style> p { color: navy; border: 2px solid blue; font-size: 22px; } h1 { color: fuchsia; text-align: center; } </style> <h1>The <a> tag with href attribute introduction</a> </h1> <p><img src="/static/imghw/default1.png" data-src="stickman.gif" class="lazy" style="max-width:90%" style="max-width:90%" alt="tag href dalam HTML" > HTML href is abbreviated as hypertext reference. This is the attribute which is available inside the anchor (<a>) tag. This href is used for website URLs like www.google.com, www.gmail.com, www.facebook.com etc.</a></p> <p>Real time Example: Day to day life we have accessed so many websites. Have you ever think about how would we access this website URLs? Because of href tag we can access any website URLs. We simply required website within this double quotes (href="website") of href attribute. </p>
Output:
Contoh #4 – tag dengan href Atribut
Kod:
<title>href attribute</title> <!--Including external CSS styles file with link tag--> <link rel="stylesheet" type="text/css" href="styles.css"> <h1>The <a> tag with href attribute introduction</a> </h1> <p>HTML href is abbreviated as hypertext reference. This is the attribute which is available inside the anchor (<a>) tag. This href is used for website URLs like www.google.com, www.gmail.com, www.facebook.com etc.</a></p> <p>Real time Example: Day to day life we have accessed so many websites. Have you ever think about how would we access this website URLs? Because of href tag we can access any website URLs. We simply required website within this double quotes (href="website") of href attribute. </p>
Kod CSS: styles.css
p { color: red; border: 2px solid green; font-size: 22px; } h1 { color: orange; text-align: center; }
Output:
Kesimpulan
hrefin HTML digunakan untuk mengakses URL web. Terdapat teg yang membenarkan atribut href, iaitu , , dan
Artikel Disyorkan
Ini ialah panduan untuk teg href dalam HTML. Di sini kita membincangkan Pengenalan kepada tag href dalam HTML dan Contohnya bersama dengan pelaksanaan dan Output kod. anda juga boleh membaca artikel cadangan kami untuk mengetahui lebih lanjut –
- 15 Sifat Teratas Teg Span dalam HTML
- Bagaimana Tag div Berfungsi dalam HTML?
- Bar Carian HTML | Contoh
- Teg Kanvas dalam HTML | Contoh
Atas ialah kandungan terperinci tag href dalam HTML. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Alat AI Hot

Undresser.AI Undress
Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover
Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool
Gambar buka pakaian secara percuma

Clothoff.io
Penyingkiran pakaian AI

AI Hentai Generator
Menjana ai hentai secara percuma.

Artikel Panas

Alat panas

Notepad++7.3.1
Editor kod yang mudah digunakan dan percuma

SublimeText3 versi Cina
Versi Cina, sangat mudah digunakan

Hantar Studio 13.0.1
Persekitaran pembangunan bersepadu PHP yang berkuasa

Dreamweaver CS6
Alat pembangunan web visual

SublimeText3 versi Mac
Perisian penyuntingan kod peringkat Tuhan (SublimeText3)

Topik panas



Panduan untuk Sempadan Jadual dalam HTML. Di sini kita membincangkan pelbagai cara untuk menentukan sempadan jadual dengan contoh Sempadan Jadual dalam HTML.

Panduan untuk HTML margin-kiri. Di sini kita membincangkan gambaran keseluruhan ringkas tentang HTML margin-left dan Contoh-contohnya bersama-sama dengan Pelaksanaan Kodnya.

Ini ialah panduan untuk Nested Table dalam HTML. Di sini kita membincangkan cara membuat jadual dalam jadual bersama-sama dengan contoh masing-masing.

Panduan untuk Susun Atur Jadual HTML. Di sini kita membincangkan Nilai Susun Atur Jadual HTML bersama-sama dengan contoh dan output n perincian.

Panduan untuk Pemegang Tempat Input HTML. Di sini kita membincangkan Contoh Pemegang Tempat Input HTML bersama-sama dengan kod dan output.

Panduan kepada Senarai Tertib HTML. Di sini kami juga membincangkan pengenalan senarai dan jenis Tertib HTML bersama-sama dengan contoh mereka masing-masing

Panduan untuk Memindahkan Teks dalam HTML. Di sini kita membincangkan pengenalan, cara teg marquee berfungsi dengan sintaks dan contoh untuk dilaksanakan.

Panduan untuk Butang onclick HTML. Di sini kita membincangkan pengenalan, kerja, contoh dan onclick Event masing-masing dalam pelbagai acara.
