w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



style media attribute

The media attribute on the style element:


The values of the media attribute (the media they represent):

Examples

<styleattribute="value(s)">...<⁄style>example
1.media=all, braille, embossed, handheld
print, projection, screen, speech
tty, tv
<style media="screen"> CSS rules <⁄style>

Video demonstration style media attribute

HTML5 style media attribute Tutorial

min video details
00:08 video tutorial: style element, media attribute
objective: to specify in which media the style sheet applies
00:15 if media attribute is absent, the default value is: all (all media) → the style applies in all media (screen, print, projection...)
00:21 in media screen (computer screen) the style applies → test OK
00:25 in media print (print preview & while printing) the style applies → test OK
00:32 adding media attribute to style element, value: screen → the style applies ONLY to screen media
00:41 in media screen (computer screen) the style applies → test OK
00:46 in media print (print preview & while printing) the style does not apply → test OK
00:53 changing the value to: print → the style applies ONLY to print media
00:57 in media screen (computer screen) the style does not apply → test OK
01:01 in media print (print preview & while printing) the style applies → test OK
01:04 you can add multiple style elements on page and specify different media for each
style intro style optional style browser display style parents - CSS rules style ELEMENT vs style ATTRIBUTE style syntaxstyle type attributestyle scoped attributestyle title attribute