Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The...
Transcript of Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The...
![Page 1: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/1.jpg)
Media Queries
![Page 2: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/2.jpg)
Media Queries
• Media queries allow the style to depend upon the media properties
• CSS 2.1 used media types<link rel="stylesheet”… href="style.css" media="screen" /><link rel="stylesheet”… href="print.css" media="print" />
![Page 3: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/3.jpg)
CSS3
• CSS3 increased the capabilities. Style can depend on many features• width, height, orientation, resolution, …
• Boolean operators can also be applied to increase power
![Page 4: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/4.jpg)
The two query components1. A media type
• screen, print, all, …2. The actual query of a media feature and
“trigger” size• width, height, orientation, resolution, …
screen and (max-device-width: 480px) and (resolution: 163dpi)
![Page 5: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/5.jpg)
How to implement media queries
• Use the @import rule@import url(smallstyle.css) screen and (min-width:600px)
• Put media query directly in the style sheet@media screen and (min-width:500px){..}
• Include query in the link<link rel = “stylesheet” media = “screen and (min-width:
400px)”> and (orientation: portrait)>
![Page 6: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/6.jpg)
Review@media screen and (min-width:500px){ p.desc {
display: block; font-size: 150%; } }
@media screen and (min-width:900px){ p.desc {
display: inline-block; width: 35%; font-size:125%; } }
![Page 7: Media Queries - WD4E · The two query components 1. A media type • screen, print, all, … 2. The actual query of a media feature and “trigger” size • width, height, orientation,](https://reader034.fdocuments.in/reader034/viewer/2022042206/5ea8a7ab66b1dc527555efd2/html5/thumbnails/7.jpg)
Acknowledgements/ContributionsThese slides are Copyright 2016- Colleen van Lent as part of http://www.intro-webdesign.com/ and made available under a Creative Commons Attribution NonCommercial 4.0 License. Please maintain this last slide in all copies of the document to comply with the attribution requirements of the license. If you make a change, feel free to add your name and organization to the list of contributors on this page as you republish the materials.
Initial Development: Colleen van Lent , University of Michigan School of Information