htmlvalidationhyperlinkhtml4

Can I leave out the rel attribute from a link element in html?


I am doing w3c validation of my HTML code. And I seem to have stumbled across persistent errors in my quest. Basically Every page that imports the link element has a problem with the using the rel attribute. The validator throws me an error saying the link attribute is at fault.

Line 8, column 54: document type does not allow element "LINK" here

I have included the link in the <head> section of my document. When I remove rel="stylesheet" then the validator will accept this.

As far as I understand the rel is use for identifying the relationship between documents. as per the W3C HTML 4.01 Transitional spec.


Solution

  • I'm not sure if I really get your problem.

    Can I leave out the rel attribute from a link element in html?

    Short answer, sure! You can use the rel attribute, but you don't have to!

    This is pretty much all you need to add a valid link to your html-file.

    <a href="http://www.google.com">I link to Google</a>