on air

HTML <base> Tag Usage.

back home » webtutorials » HTML » HTML <base> Tag Usage.


Scenario.

The <base> tag defines a default URL, for links inside a document. You can use only one <base> tag in a document, and must be placed on top of all the elements inside the <head> tag.

This allows browser to load the <base> element first so elements followed after can use information stored inside.

Quick <base> tag DOs And DON'Ts

  1. The <base> tag resides always inside the <head> tags.
  2. The <base> tag defines a default target and, or address for the entire page.
  3. The <base> tag is an empty tag and must be properly closed in XHTML as in Illustration below, otherwise should be closed without forward slash.
  4. In HTML4 and 5 the <base> tag will look like this; <base href="URL">
  5. The <base> tag doesn't assistance any standard attributes.
  6. The <base> tag uses either an href attribute, a target attribute, or both.
  7. The <base> element is supported in all browsers, and is not changed in HTML5 as from XHTML.

See Illustration below.

Defining <base> Image Source And Target For Links In The <head> Section.

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

Relative Image Source And Non-Target URL Inside <body>.

<body>
<img src="animated_logo.gif" />

<a href="https://www.ghanachild.com">GhanaChild</a>
</body>

Explaining The <base> URL Usage | Image Source.

In the <head> Section illustration above, the <base> URL for images is defined within the <head> tag, notifying browsers to look for images inside https://www.ghanachild.com/images [standard images folder].

This allow us to specify image addresses relatively in our document, [See <body> Content above].

And browsers will go looking for images inside our defined <base> URL.

See illustration below.

If we specify image source like so;
<img src="animated_logo.gif" />

Browser sees it like so;
<img src="https://www.ghanachild.com/images/
animated_logo.gif" />

Explaining The <base> Target Usage | Links.

Notice also that our defined link in the <body> content illustration has no target. However, the <base> target defined in the <head> Content takes care of, that our document opens in a new window whenever a user clicks on its link.

See illustration below.

If we specify a link like so;
<a href="https://www.ghanachild.com">GhanaChild</a>

Browser sees it like so;
<a href="https://www.ghanachild.com" 
target="_blank">GhanaChild</a>

HTML Base Element

Clicks4UrMind

Man will give you worldly powers, and make you feel on top of all, note this is temporally and could be redrawn at anytime sending you back to the ground floor of life. However, the Lord Almighty, the one and the only rightful ruler of the Universe, blesses everlastingly.

Brain

Knowledge is Power, but Power is not Knowledge. Wisdom is the truthful Power that identifies the Knowledge within the man. And only, I repeat 3x. Only the almighty God has the power to bless the man with his Wisdom forever.

To achieve the Lord's blessings, cease not praying daily, asking for his Wisdom, and you'll be blessed abundantly...

SPYERA PHONE

Spyera Phone

Spyera Phone version is software that you install on a smart phone to monitor everything happening on the phone. After installation, SPYERA secretly records events (sms, call history, phone book, location, emails, What's App messages, IM, Facebook Chat, Skype, See photos taken and many more...) that happen on the phone and delivers these information to a web account, where you can view these reports 24/7 from any Internet enabled computer or mobile phone. SPYERA also allows you to listen to the surroundings of the target mobile , listen to the phone conversation and to know the location of the device.


Please, Kindly Donate What You Can, Enabling Us Pay Hosting And Domain Costing, And Do More.

Please Donate