html
  1. html-base-tag

HTML <base> Tag

  • The <base> tag in HTML is used to specify a base URL for all relative URLs within a document.
  • It sets the base URL for the entire document, which means that if you have multiple relative links, they will all be resolved based on the provided base URL.
  • The <base> tag is placed within the element of the HTML document.

<!DOCTYPE html>
<html lang="en">
<head>
  <base href="https://additionalsheet.com/" target="_blank">
  <title>Additionalsheet</title>
</head>
<body>
  <p><a href="html">HTML</a></p>
  <p><a href="css">CSS</a></p>
</body>
</html>
Try Playground
  • The <base> tag has the href attribute set to "https://additionalsheet.com/". This means that any relative URLs within the document will be resolved based on this base URL.

Base Attributes

  • _self: This is the default behavior. The linked document will open in the same frame or window as the current document.
  • _blank: The linked document will open in a new, unnamed browser window or tab.
  • _parent: The linked document will open in the parent frame or window of the current frame or window.
  • _top: The linked document will open in the full body of the window, canceling out any frames.

These values determine the target context for the link, affecting how the linked content is displayed.

Published on: