Docs/HTML/Links

HTML Links

Link dibuat dengan elemen <a> (anchor). Atribut href menentukan URL tujuan.

Atribut Penting

  • href — URL tujuan link
  • target="_blank" — buka di tab baru
  • title — tooltip saat hover
  • rel="noopener" — keamanan untuk target _blank

Jenis Link

  • Absolute URL: https://google.com
  • Relative URL: about.html
  • Anchor: #section1
  • Email: mailto:email@example.com
  • Phone: tel:+62123456
index.html
Try It →
<h2>Contoh Links</h2>
<p><a href="https://google.com">Link ke Google</a></p>
<p><a href="https://github.com" target="_blank">Buka GitHub (tab baru)</a></p>
<p><a href="#section1">Link ke Section 1 (anchor)</a></p>
<p><a href="mailto:hello@example.com">Kirim Email</a></p>
<p><a href="tel:+6281234567890">Telepon</a></p>

<div id="section1">
  <h3>Section 1</h3>
  <p>Kamu sampai di section 1!</p>
</div>