Is there no difference between No media and media="all"?
<link rel="stylesheet" type="text/css" media="all" href="style.css">
and
<link rel="stylesheet" type="text/css" href="style.css">
The media attribute specifies what media/device the target resource is optimized for. This attribute is mostly used with CSS style sheets to specify different styles for different media types. The media attribute can accept several values.
@media is the actually media query. The word screen is adding the 'conditions' to the media query. So @media screen is telling the media query to apply (whatever other conditions) to screens. For example, @media screen and (max-width: 360px) will target only screens with a max-width of 360px.
The Placement of Media Queries The internal method includes adding the <style> tag to the <head> tag of the HTML file, and creating the media query within the parameters of the <style> tag. The external method involves creating a media query in an external CSS file and linking it to your HTML file via the <link> tag.
In HTML 4.01, the default value is screen
.
In HTML5, the default value has been changed to all
.
Therefore, it depends on the doctype declaration you use in your page. Never mind, user agents get confused about standards anyway; see Knu's comment. (I bet this is why they changed it to all
in HTML5.)
Then again, this only really matters if you're supporting user agents that don't present pages on digital screens, or display any visual information for that matter.
Both yes and no it seems. In section 14.4.1 in the specs it says that a stylesheet without a media-type applies to all medias, whilst the other are filtered out when not needed. But in section 14.2.3 it should default to screen, which should be used on non-paged computer screens whilst all should be suitable for all devices (more information on media-descriptors here).
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