Component-level art direction with CSS Container Queries
Sara Soueidan · May 9, 2021
Container Queries (CQ) allow us to change the styles of a component so it responds to the size of its nearest container. With CQ, we can change how an element looks based on where on a page it is placed and how much horizontal space it occupies.
A lot about a design pattern could change based on how much space it’s got. So Container Queries can be used to do more than just shift elements around in a layout. (Have you seenJhey’s demo yet?!) But we can only take full advantage of the potential Container Queries offer us if we can use them everywhere a typical viewport media query can be used.
Now that we got Container Queries in CSS, I want them in HTML, too. More specifically, I can see them coming in more handy if they were available in HTML to change an image’s source inside <picture>, just like viewport-based media queries currently are. This would enable us to art-direct images instead of cropping them to fit in a layout.
Keep reading
Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.
What do you usually think about when you think about focus indicators? Probably outlines? Maybe borders and background color changes, too? That’s what I would normally think about. When we talk about focus indicators, the discussion usually
I love the Web platform, and it’s a privilege that we, the web community, get a chance to influence what browser makers work on every year. For the second year in a row, Firefox has created a page that allows us to rank the Interop 2027 fea
Changelog Despite the fact that Chrome exposes the alt text of a CSS image as part of the accessible name of the element it is used on, James Scholes shared that the alt text is not announced by NVDA, which means that screen reader users us
Kevin and I been planning this podcast for months and our schedules finally aligned and we made it happen. We originally planned to chat for a bit… but we had so much fun that almost two hours flew by without us noticing 😅 We covered: Defin
✨ This post is sponsored by everyone who has bought my Practical Accessibility course. ✨ The Bootstrap Scrollspy—now commonly known as just “Scrollspy”—is a feature that automatically updates navigation links based on the user’s scroll posi