<link rel='stylesheet' type='text/css' media='screen' href='css/styles.css' /> <link rel='stylesheet' type='text/css' media='print' href='css/print.css' />
@media screen { p { color: blue; } } @media print { p { color: red; } }
<link media="screen" ...
<style> @import "myCSS.css"; ...
@import url(myCSS.css) screen; IE8+
@media screen {}
<?xml-stylesheet media="screen" ...
<link rel='stylesheet' media='screen and (min-width: 320px) and (max-width: 480px)'
href='css/smartphone.css' />
@media screen and (max-width: 480px){ a { transition: background-color 200ms linear 50ms; } } @media screen and (orientation: landscape) { a[href^="mailto:]:before { content: url(icons/email.gif); } }
media="only print and (color)" media="only screen and (orientation: portrait)" media="not screen and (color)" media="print, screen and (min-width: 480px)"
@media screen and (-webkit-min-device-pixel-ratio: 2) { .iphone4 { /* high DPI */} } @screen and (transform-3d) { .transforms {} }
Also works with (animation)
and (transition)
body { -<prefix>-transition: all 1.5s linear; } @media only screen and (orientation: portrait) { body{ background: indianred; } } @media only screen and (max-width: 480px) { body{ background: palegoldenrod; } }
shrink this window to see the presentation change colors