HTML <a> href Özelliği

❮ HTML <a> etiketi

Örnek

href özelliği, bağlantının hedefini belirtir:

<a href="https://www.w3schools.com">Visit W3Schools</a>

Aşağıda daha fazla "Kendiniz Deneyin" örnekleri.


Tanım ve Kullanım

Nitelik href, bağlantının gittiği sayfanın URL'sini belirtir.

Nitelik hrefmevcut değilse, <a>etiket bir köprü olmayacaktır.

İpucu: Geçerli sayfanın en üstüne bağlantı vermek için href="#top"veya öğesini kullanabilirsiniz !href="#"


Tarayıcı Desteği

Attribute
href Yes Yes Yes Yes Yes

Sözdizimi

<a href="URL">

Özellik Değerleri

Value Description
URL The URL of the link.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/default.htm")
  • A relative URL - points to a file within a web site (like href="default.htm")
  • Link to an element with a specified id within the page (like href="#section2")
  • Other protocols (like https://, ftp://, mailto:, file:, etc..)
  • A script (like href="javascript:alert('Hello');")


Daha fazla örnek

Örnek

Bir resim bağlantı olarak nasıl kullanılır:

<a href="https://www.w3schools.com">
<img border="0" alt="W3Schools" src="logo_w3s.gif" width="100" height="100">
</a>

Örnek

Bir e-posta adresine nasıl bağlantı verilir:

<a href="mailto:[email protected]">Send email</a>

Örnek

Bir telefon numarasına nasıl bağlantı verilir:

<a href="tel:+4733378901">+47 333 78 901</a>

Örnek

Aynı sayfadaki başka bir bölüme nasıl bağlantı verilir:

<a href="#section2">Go to Section 2</a>

Örnek

JavaScript'e nasıl bağlantı verilir:

<a href="javascript:alert('Hello World!');">Execute JavaScript</a>

❮ HTML <a> etiketi