- Courses
- HTML
- HTML top level tags
- <base>
- Effect of multiple base elements
What happens if multiple <base>
elements are used in a document?
If multiple <base>
elements are used, only the first href
and target
attributes are obeyed.
Subsequent <base>
elements are ignored, meaning they have no effect on the document's base URL or target context. This ensures that the document's base URL is consistently applied, preventing conflicts or unexpected behavior from multiple base definitions.
<base href="https://first.com/">
<base href="https://second.com/"> <!-- Ignored -->