Link styles correctly

Asked

Viewed 26 times

1

I am slowly deepening into the web world, and today I noticed something unusual in my code, good, unusual more or less let’s look at the examples.

In this code I use the type="text/css"

<link rel="stylesheet" type="text/css" href="caminho aqui">

And in this I no longer use

<link rel="stylesheet" href="caminho aqui">

Both work, but is there a problem if you don’t set the type? I need a very concrete answer that clears my doubt.

1 answer

1


Nowadays it is no longer necessary to use the attribute type.

In the version 4 of HTML the attribute was still referred to, but indicating that it "gives a hint" to the browser about the content, and from the text it was not mandatory:

This attribute gives an Advisory hint as to the content type of the content available at the link target address. [...] Authors who use this attribute...

In the html 5 specification is even clearer:

The type attribute gives the MIME type of the Linked Resource. It is Purely Advisory.

The attribute is purely a suggestion (freely translating).

  • Since I didn’t get any more answers, I’ll be marking yours as settled, and thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.