htmlattributesbase-url

Is there an HTML attribute dedicated to setting the base URL for all descendants of an element?


HTML provides the base element as a means of specifying the base URL for all relative links in a document:

div,ol {margin:0;}
<!DOCTYPE html>
<html lang="en">
  <head>
    <base href="https://stackoverflow.com/questions/tagged/">
    <base target="_blank">
  </head>
  <body>
    <div>Web Development Tags at StackOverflow.com :</div>
    <ol>
      <li><a href="css">css</li>
      <li><a href="javascript">javascript</li>
      <li><a href="html">html</li>
    </ol>
  </body>
</html>

However, as is, it only allows one base URL per document.

Given the hierarchical nature of HTML, I was hoping I could find an HTML attribute dedicated to setting the base URL for all descendants of an element. I cannot find this.

If no attribute like this exists, I would imagine that it was already proposed a long time ago, and I'm interested in why it was rejected. This too, I have not found.


Solution

  • From a comment by Alohci:

    It was indeed proposed a long time ago. At least once, in May 2007. And the xml:base attribute dates back at least as far as 1999. - Alohci, Oct 29, 2021 at 13:02