HTML href Özelliği
Tanım ve Kullanım
<a>
ve <area>
öğeleri için
öznitelik href
, bağlantının gittiği sayfanın URL'sini belirtir.
<base>
Öğeler için
özellik href
, bir sayfadaki tüm göreli URL'lerin temel URL'sini belirtir.
<link>
Öğeler için
öznitelik href
, dış kaynağın (çoğunlukla bir stil sayfası dosyası) konumunu (URL) belirtir.
Şunlar için geçerlidir:
Nitelik href
aşağıdaki öğelerde kullanılabilir:
Elementler | Bağlanmak |
---|---|
<a> | href |
<alan> | href |
<taban> | href |
<bağ> | href |
Örnekler
Bir Örnek
href özelliği, bağlantının hedefini belirtir:
<a href="https://www.w3schools.com">Visit W3Schools</a>
Alan Örneği
Tıklanabilir alanları olan bir resim haritası:
<img src="planets.gif"
width="145" height="126"
alt="Planets"
usemap="#planetmap">
<map
name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
Temel Örnek
Bir sayfadaki tüm göreli URL'ler için bir temel URL belirtin:
<head>
<base href="https://www.w3schools.com/images/">
</head>
Bağlantı Örneği
Harici bir stil sayfasına bağlantı:
<link rel="stylesheet" type="text/css" href="theme.css">
Tarayıcı Desteği
Nitelik href
, her öğe için aşağıdaki tarayıcı desteğine sahiptir:
Element | |||||
---|---|---|---|---|---|
a | Yes | Yes | Yes | Yes | Yes |
area | Yes | Yes | Yes | Yes | Yes |
base | Yes | Yes | Yes | Yes | Yes |
link | Yes | Yes | Yes | Yes | Yes |