Depending on where I look, I see different way to include css.
Examples
<link rel="stylesheet" type="text/css" media="screen, projection" href=""/>
<link rel="stylesheet" type="text/css" media="all" href=""/>
<link rel="stylesheet" type="text/css" media="screen" href=""/>
<link rel="stylesheet" href=""/>
Do they all do the same?
Is one of them the correct way?
All are correct.
The type
attribute is not required - it is just a hint for browsers but can be omitted.
The media
attribute tells the browser when the CSS file should be used. For example, if you specify media="print"
the CSS file will only get used when printing the page (try to print a Wikipedia page, for example).
Generally this variant is fine in most situations:
<link rel="stylesheet" type="text/css" href="..."/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With