Tag HTML <base>


Esempio

Specifica un URL predefinito e una destinazione predefinita per tutti i collegamenti in una pagina:

<head>
  <base href="https://www.w3schools.com/" target="_blank">
</head>

<body>
<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>

Definizione e utilizzo

Il <base>tag specifica l'URL di base e/o di destinazione per tutti gli URL relativi in ​​un documento.

Il <base>tag deve avere un attributo href o target presente o entrambi.

Può esserci un solo <base>elemento in un documento e deve trovarsi all'interno dell'elemento <head>.


Supporto browser

Element
<base> Yes Yes Yes Yes Yes

Attributi

Attribute Value Description
href URL Specifies the base URL for all relative URLs in the page
target _blank
_parent
_self
_top
Specifies the default target for all hyperlinks and forms in the page

Attributi ed eventi globali

Il <base>tag supporta anche gli attributi globali in HTML .


Attributi dell'evento

 Il <base>tag non supporta alcun attributo di evento.


Pagine correlate

Riferimento HTML DOM: oggetto base


Impostazioni CSS predefinite

Nessuno.