Repository navigation
Description
Media queries are a very useful feature. Servo has support for the syntax and a general framework for implementing them through Stylo. And it supports a few of the most common query types. However there are a large number of media queries that we don't support.
Spec: https://www.w3.org/TR/mediaqueries-5/
MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Using_media_queries
We have a bug report on Blitz that @media(hover: hover) is required for tailwind: DioxusLabs/blitz#252
List of media queries
This is a list of all of the media query types supported by Gecko. The ones supported by Servo are ticked.
- width
- height (Implement the
heightandorientationmedia features stylo#395) - orientation (Implement the
heightandorientationmedia features stylo#395) - aspect-ratio (stylo: add aspect-ratio media feature #45490)
- device-width (layout: Enable
device-width/device-heightmedia queries #44978) - device-height (layout: Enable
device-width/device-heightmedia queries #44978) - device-aspect-ratio
- device-pixel-ratio
- transform-3d
- resolution
- display-mode
- grid
- scan
- color
- color-index
- monochrome
- color-gamut
- prefers-color-scheme
- prefers-reduced-motion (layout: Make Servo compatible with Stylo with extra preference media query support #42011)
- prefers-reduced-transparency (layout: Make Servo compatible with Stylo with extra preference media query support #42011)
- prefers-contrast (layout: Make Servo compatible with Stylo with extra preference media query support #42011)
- forced-colors
- inverted-colors
- overflow-block
- overflow-inline
- update
- dynamic-range
- video-dynamic-range
- scripting
- pointer (layout: implement pointer and hover media features #45681)
- any-pointer (layout: implement pointer and hover media features #45681)
- hover (layout: implement pointer and hover media features #45681)
- any-hover (layout: implement pointer and hover media features #45681)
Implementation hints
- The Servo implementations of the queries live in https://github.com/servo/stylo/blob/main/style/servo/media_queries.rs
- The Gecko implementations of the queries live in https://github.com/servo/stylo/blob/main/style/gecko/media_features.rs
Our general stratagy thus-far has been to pass data into Stylo via the Device
See these PRs implementing the prefers-color-scheme media query:
Activity
servo-highfive commentedon Sep 1, 2025
cc @emilio
servo-highfive commentedon Jun 14, 2026
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in Zulip.
If you intend to work on this issue, then add
@servo-highfive: assign meto your comment, and I'll assign this to you. 😄Please read our policy on AI contributions before getting started.
layout: implement pointer and hover media features (servo#45681)
layout: implement pointer and hover media features (servo#45681)
stylo: add aspect-ratio media feature (servo#45490)
layout: Enable `device-width`/`device-height` media queries (servo#44978
Implement `height` and `orientation` media features (servo#45707)
sahil0x01 commentedon Nov 10, 2026
@servo-highfive: assign me
servo-highfive commentedon Nov 10, 2026
Hey @sahil0x01! Thanks for your interest in working on this issue. It's now assigned to you!
stylo: add device-aspect-ratio media feature
stylo: add device-aspect-ratio media feature
stylo: add device-aspect-ratio media feature (servo#49775)
layout: Make Servo compatible with Stylo with extra preference media …
layout: Make Servo compatible with Stylo with extra preference media …