Can the `<link>` tag be used to link files aside from CSS to our HTML document?

Question

Can the <link> tag be used to link files aside from CSS to our HTML document?

Answer

Yes it can!

7 Likes

Although linking stylesheets is the most commonly used application of the tag, it can also be used to establish site icons (both “favicon” style icons and icons for the home screen and apps on mobile devices), as described in MDN (Mozilla Developer Network) Web Docs here.

19 Likes
  1. What types are there (text/css, …)?

  2. Considering the pushing of semantics, why wasn’t <style src="">, <script src="">, and ` chosen? Why href instead of src anyway?

5 Likes

What I learned is that when you use “src” the document stops rendereing until it loads the content of the tag completely, but when you use href the page doesnt stop working, it just makes a anchor for that content on the tag.

9 Likes

That’s rather interesting, thanks for the insight!

3 Likes