CSS media queries beyond width

  • To make sure that your media queries are used for print, screen, and in all situations we add an all at the start.
  • We always had the ability to connect a stylesheet with a type of media like print.
<link rel="stylesheet" href="s.css" type="print" />
  • Through the CSS and the @media rule or in our media queries we can do a lot more.
  • We can use orientation with a value of landscape or portrait
  • We can combine multiple property tests with and or or between the test conditions.
@media all and (min-width: 600px) {
}
@media all and (orientation: landscape) {
}
@media all and (min-aspect-ratio: 2/1) {
}
@media all and (aspect-ratio: 1/1) {
  /* for perfectly square screens */
}
@media all and (min-resolution: 200dpi) {
}
  • We can also look at the aspect-ratio, or resolution of devices with media queries.
  • The width, height, aspect-ratio, and resolution properties all have a min- and max- value.
Last Updated: : 8/26/2019, 2:49:01 PM