Why do we use – rinogo Aug 07 '19 at 01:31

  • 1
    @rinogo yep, you have a good point there! Thinking about it now, it's true for images too. Although we generally point to other files, we can always embed them with base64, what is not true with href elements. To use an inline CSS we'd have to use – Felipe Elia Aug 08 '19 at 12:57
  • 1

    Possible reason for link ref vs style:

    link can only go on the head, where "Metadata content" is allowed, typically head,

    style could not go in the body before HTML5 (now you can with scoped, but still not to external styles). Therefore, the choice between link ref and style src is arbitrary.

    script, however, could already include an external script in the body before HTML5, so there had to be script src. But since it had to exist, why not allow it in the head as well (where script was already allowed), and disallow link rel=script to avoid duplication?

    Apparently Tim Berners-Lee wanted everything to be done with <a: https://youtu.be/3QEoJRjxnxQ?t=901 !

    Ciro Santilli OurBigBook.com
    • 347,512
    • 102
    • 1,199
    • 985
    1

    The <link> tag is used to "link" other documents to the current one, and describe it's relationship, or rel, with it.

    You can also use <link> to link other things to the document. For example, favicons:

    <link rel="shortcut icon" href="favicon.ico" />
    
    gen_Eric
    • 223,194
    • 41
    • 299
    • 337
    • 3
      Agree: link can be used to link to many things (one for each rel type), so the really surprising point about the interface is why not use `link` for scripts as asked [here](http://stackoverflow.com/questions/2631635/can-i-load-javascript-code-using-link-tag). – Ciro Santilli OurBigBook.com Dec 31 '13 at 17:11
    1

    This might explain things, I guess: http://www.w3.org/TR/html4/struct/links.html

    Edgar
    • 4,348
    • 4
    • 40
    • 59