<link> vs <a>: when to use one over the other?

Attributes are not the same as the tag they are in.

<link /> is an empty element, i.e. it can not have anything inside of it. All it does is specify a relationship with another document. Additionally, the <link> tag is only used in the <head> section.

<a></a> on the other hand, is not an empty element and specifies an object to be created on the page - like a clickable link or image - which takes the user to some other location. This tag is only used in the <body> section.

So, even though the tags can have the same attributes, that does not mean they do the same thing.


Anything in <a>insideanchortag</a> is visible to end user

But you cant see the <link /> data in end user view, It is only visible in inspect element.


You can't use A tag to add css to HTML document because it is meant for creating clickable hyperlinks between documents.

But if you would like to create link allowing users to download css file you could do this

<a type="text/css" rel="stylesheet" href="/spinner/styles.css?ln=css">Download css</a>