Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.


purpose

as per this article on w3schools :

The media rule is used in media queries to apply different styles for different media types/devices

Media queries can be used to check many things, such as:

  • width and height of the viewport

  • width and height of the device

  • orientation (is the tablet/phone in landscape or portrait mode?)

  • resolution

  • printing, ...


example - width

Loading...

common pitfall


example - print

Loading...

another way to use media rules is to conditionnally apply a CSS <link> tag from the <head> node

<link rel="stylesheet"
    <!-- NOTE the new media attribute here -->
    media="screen and (min-width: 900px)"
    href="widescreen.css">

devel tools and multi-device



see also


practice - responsive grid

  1. open the example below in a separate window
    and observe behaviour on narrow, mid-size, and large viewport

  2. write an HTML document and related CSS that mimicks it
    at least for viewports smaller and larger than 512px

Loading...