Context Queries in CSS

Posted on November 18, 2020

Media queries are firmly established methods for serving custom experiences based on the media being used to access content.

However, there’s no way to an experience based on the context being used. How crazy would it be would it be if this were possible?

Imagine some code that went like:

@context (currently-traveling:yes AND role:driver) 
{ * {display:none;} } /* hide app from a distracted driver }

That’s some scary stuff, privacy-wise, but you know if it were possible people’d be writing it. But just think of what you could do with

environment:outdoors
or
noise-level:loud

Leave a Reply

Your email address will not be published. Required fields are marked *

Blog link