Search
“Smart” Layouts With Container Queries
14.8.2024
Modern CSS keeps giving us a lot of new, easier ways to solve old problems, but often the new features we’re getting don’t only solve old problems, they open up new possibilities as well.
Container queries are one of those …
“Smart” Layouts With Container Queries originally published...
JavaScript print Events
30.12.2022
Media queries provide a great way to programmatically change behavior depending on viewing state. We can target styles to device, pixel ratio, screen size, and even print. That said, it’s also nice to have JavaScript events that also allow us to change behavior. Did you know you’re...
The New CSS Media Query Range Syntax
31.10.2022
The Media Queries Level 4 specification has introduced a new syntax for targeting a range of viewport widths using common mathematical comparison operators, like , and =, that make more sense syntactically while writing less code for responsive web design.
The New CSS Media Query Range Syntax...
Responsive Layouts, Fewer Media Queries
22.11.2021
We cannot talk about web development without talking about Responsive Design. It’s just a given these days and has been for many years. Media queries are a part of Responsive Design and they aren’t going anywhere. Since the introduction of …
The post Responsive Layouts, Fewer Media Queries...
Expandable Sections Within a CSS Grid
15.10.2021
I love CSS Grid. I love how, with just a few lines of code, we can achieve fully responsive grid layouts, often without any media queries at all. I’m quite comfortable wrangling CSS Grid to produce interesting layouts, while keeping …
The post Expandable Sections Within a CSS Grid appeared...
Proposal for CSS @when
22.9.2021
CSS is on a tear lately. Again, I’ve heard of a brand new thing I’ve never seen before, and again it’s via Miriam: CSS Conditionals.
???? CSSWG just resolved to adopt @tabatkins when/else proposal into the next level of CSS
…
The post Proposal for CSS @when appeared...
Can we have custom media queries, please?
8.9.2021
Stefan Judis notes that there is a spec for custom media queries, but seemingly no momentum on it at the moment. That lack of movement is unfortunate, as it’s almost guaranteed front-end developers all over would start using it as …
The post Can we have custom media queries, please?...
Detecting Media Query Support in CSS and JavaScript
23.8.2021
You can’t just do @media (prefers-reduced-data: no-preference) alone because, as Kilian Valkhof says:
[…] that would be false if either there was no support (since the browser wouldn’t understand the media query) or if it was supported but the
…
The post...
Are we in a new era of web design? What do we call it?
21.6.2021
Una is calling it the new responsive. A nod to the era we were most certainly in, the era of responsive design. Where responsive design was fluid grids, flexible media, and media queries, the new responsive is those things …
The post Are we in a new era of web design? What do we call...
Media Queries in Times of @container
15.6.2021
Max Böck took me up on my challenge to look through a codebase and see how many of the @media queries could ultimately become @container queries.
I took the bait and had a look at some of my projects –
…
The post Media Queries in Times of @container appeared first on CSS-Tricks.
You...
Hexagons and Beyond: Flexible, Responsive Grid Patterns, Sans Media Queries
3.6.2021
A little while back, Chris shared this nice hexagonal grid. And true to its name, it’s using —wait for it — CSS Grid to form that layout. It’s a neat trick! Combining grid columns, grid gaps, and creative clipping …
The post Hexagons and Beyond: Flexible, Responsive Grid Patterns, Sans Media...
Custom State Pseudo-Classes in Chrome
6.5.2021
There is an increasing number of “custom” features on the web platform. We have custom properties (--my-property), custom elements (<my-element>), and custom events (new CustomEvent('myEvent')). At one point, we might even get custom media …
The post Custom State Pseudo-Classes...
Platform News: Defaulting to Logical CSS, Fugu APIs, Custom Media Queries, and WordPress vs. Italics
12.3.2021
Looks like 2021 is the time to start using CSS Logical Properties! Plus, Chrome recently shipped a few APIs that have raised eyebrows, SVG allows us to disable its aspect ratio, WordPress focuses on the accessibility of its typography, and …
The post Platform News: Defaulting to Logical...
Weekly Platform News: Focus Rings, Donut Scope, Ditching em Units, and Global Privacy Control
4.3.2021
In this week’s news, Chrome tackles focus rings, we learn how to get “donut” scope, Global Privacy Control gets big-name adoption, it’s time to ditch pixels in media queries, and a snippet that prevents annoying form validation styling.
Chrome will…
The post Weekly...
Nested Media Queries
9.2.2021
We don’t have “regular” nesting in CSS. Maybe this becomes a thing someday, or something like it. That would be cool, although that pre-spec doesn’t mention anything about media queries. I’d hope we get that right out of the gate …
The post Nested Media Queries...
Weekly Platform News: The :not() pseudo-class, Video Media Queries, clip-path: path() Support
5.2.2021
Hey, we’re back with weekly updates about the browser landscape from Šime Vidas.
In this week’s update, the CSS :not pseudo class can accept complex selectors, how to disable smooth scrolling when using “Find on page…” in Chrome, Safari’s …
The post Weekly...
Creating websites with prefers-reduced-data
8.12.2020
Spoiler alert: There is no support for it yet. But it is defined in the Media Queries Level 5 spec that includes other recent, but more familiar user preference features, like prefers-color-scheme and prefers-reduced-motion.
The Polypane blog goes into incredible depth on prefers-reduced-data...
A Complete Guide to CSS Media Queries
2.10.2020
Media queries can modify the appearance (and even behavior) or a website or app based on a matched set of conditions about the user's device, browser or system settings.
The post A Complete Guide to CSS Media Queries appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter
Achieving Vertical Alignment (Thanks, Subgrid!)
30.9.2020
Our tools for vertical alignment have gotten a lot better as of late. My early days as a website designer involved laying out 960px wide homepage designs and aligning things horizontally across a page using a 12-column grid. Media queries came along which required a serious mental shift. It solved...
Linearly Scale font-size with CSS clamp() Based on the Viewport
25.9.2020
Responsive typography has been tried in the past with a slew of methods such as media queries and CSS calc().
Here, we’re going to explore a different way to linearly scale text between a set of minimum and maximum sizes as the viewport’s width increases, with the intent of making its behavior...