The <base> Element
As defined in the HTML Living Standard, the <base> element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks.
If you set the base URL to https://example.com/assets/, a link like <a href="logo.png"> will resolve to https://example.com/assets/logo.png.
<head>
<base href="https://www.simpleaccess.io/" target="_blank">
</head>
View HTML Living Standard: The base element
Technical Requirements & Constraints
- Placement: It must be inside the
<head>element. - Quantity: A document must not have more than one
<base>element. - Attributes: It supports
href(to set the base URL) andtarget(to set default link behavior, e.g.,_blank).
WCAG Requirement: Link Purpose
Success Criterion 2.4.4 (Level A): The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context.
When using <base>, ensure that relative links still resolve to meaningful destinations. If a developer incorrectly sets the base URL, every relative link on the page becomes a broken experience for keyboard and screen reader users.
Critical Accessibility Risks
Improper use of the <base> tag can create significant accessibility barriers:
- In-Page Navigation: If a base URL is defined, anchor links like
<a href="#content">may attempt to navigate to the base URL + the hash, rather than jumping within the current page. This breaks "Skip to Content" links. - Target Overrides: Setting
target="_blank"globally via<base>forces all links to open in new tabs, which can be disorienting for users with cognitive disabilities or those using screen readers.
A11y Tip: Be Explicit
Avoid using <base target="_blank">. It is better to handle link targets explicitly on a per-link basis and inform the user when a link will open in a new window to satisfy WCAG SC 3.2.2 (On Input).