Horje

Example

There can only be one single <base> element in a document! Specify a default URL and a default target for all links on a page:
index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
  <base href="https://www.w3schools.com/" target="_blank">
</head>
<body>

<h1>The base element</h1>

<p><img src="images/stickman.gif" width="24" height="39" alt="Stickman"> - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "https://www.w3schools.com/images/stickman.gif".</p>

<p><a href="tags/tag_base.asp">HTML base tag</a> - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank".</p>

</body>
</html>

Output should be:

Example



Single Articles
ExampleHTML - The Head Element
ExampleHTML - The Head Element


Related Articles
What is HTML - The Head Element HTML - The Head Element
How to create The HTML <head> Element HTML - The Head Element
How to create The HTML <title> Element in <Head> HTML - The Head Element
How to create The HTML <style> Element in <head> HTML - The Head Element
How to create The HTML <link> Element in <head> HTML - The Head Element
How to create The HTML <meta> Element in Head HTML - The Head Element
What is The HTML Viewport in Head HTML - The Head Element
How to use HTML Viewport in Head HTML - The Head Element
How to create The HTML <script> Element in head HTML - The Head Element
How to create The HTML <base> Element in head HTML - The Head Element

Type:
Html
Category:
Web Tutorial
Sub Category:
HTML - The Head Element
Uploaded by:
Admin



Share on: