Search
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...
Next Gen CSS: @container
11.5.2021
Chrome is experimenting with @container, a property within the CSS Working Group Containment Level 3 spec being championed by Miriam Suzanne of Oddbird, and a group of engineers across the web platform. @container brings us the ability to …
The post Next Gen CSS: @container appeared first...
Sticky Headers: 5 Ways to Make Them Better
21.4.2021
Page Laubheimer says that if you’re going to do a sticky header…
Keep it small.
Visually contrast it with the rest of the page.
If it’s going to move, keep it minimal. (I’d say, respect prefers-reduced-motion.)
Consider “partially persistent
…
The post Sticky...
A DRY Approach to Color Themes in CSS
24.2.2021
The other day, Florens Verschelde asked about defining dark mode styles for both a class and a media query, without repeat CSS custom properties declarations. I had run into this issue in the past but hadn’t come up with a …
The post A DRY Approach to Color Themes in CSS appeared first...
How to Build a GraphQL API for Text Analytics with Python, Flask and Fauna
11.2.2021
GraphQL is a query language and server-side runtime environment for building APIs. It can also  be considered as the syntax that you write in order to describe the kind of data you want from APIs. What this means for you …
The post How to Build a GraphQL API for Text Analytics with...
Responsible, Conditional Loading
25.12.2020
Over on the Polyplane blog (there’s no byline but presumably it’s Kilian Valkhof), there is a great article, Creating websites with prefers-reduced-data, about the prefers-reduced-data media query. No browser support yet, but eventually you can use it in CSS to make choices that reduce...
Minimal Takes on Faking Container Queries
2.12.2020
It’s sounding more and more likely that we’re actually going to get real container queries. Google is prototyping a syntax idea from David Baron and refined by Miriam Suzanne. Apparently, there has already been some prototyping done for a switch() syntax which is like container queries...
Pre-Caching Image with React Suspense
21.9.2020
Suspense is an exciting, upcoming feature of React that will enable developers to easily allow their components to delay rendering until they’re “ready,” leading to a much smoother user experience. “Ready,” in this context, can mean a number of things. For example, your data loading...
How to Make a Media Query-less Card Component
1.9.2020
Fun fact: it’s possible to create responsive components without any media queries at all. Certainly, if we had container queries, those would be very useful for responsive design at the component level. But we don’t. Still, with or without container queries, we can do things to make our components...
Holy Albatross with Widths
24.7.2020
Heydon’s Holy Albatross is a technique to have a row of elements break into a column of elements at a specific width. A specified parent width, not a screen width like a media query would have. So, like a container query (ya know, those things that don’t exist yet that we...
Levels of Fix
20.7.2020
On the web, we have the opportunity to do work that fixes things for people. It’s fascinating to me how different the scope of those fixes can be.
Consider the media query prefers-reduced-motion. Eric wrote:
I think it’s also worth pointing out the true...
A First Look at `aspect-ratio`
29.5.2020
Oh hey! A brand new property that affects how a box is sized! That’s a big deal. There are lots of ways already to make an aspect-ratio sized box (and I’d say this custom properties based solution is the best), but none of them are particularly intuitive and certainly not...
How to Display Mode-Specific Images
4.5.2020
Now that we have most of the basics of HTML and CSS in the browser, we’ve begun implementing new features that I would consider “quality of life” improvements, many of which have been inspired by mobile. One great example is the CSS prefers-color-scheme media query, which allows...
CSS-Only Marquee Effect
5.4.2020
You make sure the text is more than twice the width of the screen, then use negative translate animations to do the marquee movement.
You’ll probably want to aria-hidden all but one of them if you need to duplicate the text. Or, you could use a very clever CSS trick...
gqless
30.3.2020
This is so cool. I mean, GraphQL is already cool. It’s very satisfying to write an understandable-looking query for whatever you want and then use that data in templates.
But what if you didn’t have to write the query at all? What if you just wrote the templates pretending you already...
Toward Responsive Elements
12.2.2020
Hot news from Brian Kardell, regarding what we've been referring to as "container queries", the most hotly requested feature in CSS:
There does seem to be some general agreement on at least one part of what I am going to call instead "Responsive Design for Components" and that is that flipping...
Component-Level CMSs
23.1.2020
When a component lives in an environment where the data queries populating it live nearby, there is a pretty direct line between the visual component and the database where that exact content lives. That is opening up doors to site editing experiences that travel that line. We're starting to...
The Ultimate Guide to Dark Mode for Email Marketers
7.1.2020
On the regular web (I suppose) we handle "dark mode" with the CSS prefers-color-scheme media query. But, and to nobody's surprise, it's way weirder in the land of HTML email. The weirdness is that across different email clients, they handle the dark mode thing differently, starting with the fact...
Dark Mode Favicons
4.12.2019
Oooo! A bonafide trick from Thomas Steiner. Chrome will soon be supporting SVG favicons (e.g. <link rel="icon" href="/icon.svg">). And you can embed CSS within an SVG with a <style> element. That CSS can use a perfers-color-sceme media query, and as a result, a favicon that supports...
Query JSON documents in the Terminal with GROQ
7.11.2019
JSON documents are everywhere today, but they are rarely structured the way you want them to be. They often include too much data, have weirdly named fields, or place the data in unnecessary nested objects. Graph-Relational Object Queries (GROQ) is a query language (like SQL, but different) which...