Measure twice, publish once.

NEWS·Aljoša Vodan·

Why CSS Container Queries Aren't What You Think: The Modern Path to Truly Flexible Websites

Why CSS Container Queries Aren't What You Think: The Modern Path to Truly Flexible Websites

What happened and why it matters to you

Modern web technology has gained a powerful tool called CSS container queries, which allows web components to adapt to the space actually available to them, rather than just the size of the entire screen. Even though this feature is now supported by roughly 94% of browsers, according to the State of CSS survey only 41.4% of developers actually use it, despite 86% of respondents being aware of it. Smashing Magazine points to an even bigger problem in its article: many of those who do use container queries are using them incorrectly, treating them as if they were ordinary media queries.

For the owner of a small or medium Slovenian business, this might sound like a dry technical story, but it's actually something very tangible. It comes down to whether your website works flawlessly on every device and in every corner of the layout, or whether content spills over, overlaps, and becomes unusable in certain places. This directly affects how many visitors stay and how many leave for a competitor.

Background: how we've built flexible websites until now

To understand why this development matters, we first need to explain how websites even know they need to adapt to different screens.

Media queries look outward

For more than a decade, responsive design has been based on what are known as media queries. These work in a simple way: they ask the browser a single question, how wide is the current screen. If the screen is wider than a certain threshold, the layout changes, for example from two columns to one on a mobile phone.

This approach has served well for a decade, but it has one major drawback. As Kevin Powell, a well-known CSS expert, vividly puts it, media queries are essentially "dumb," not by design, but because they know very little. They only know the size of the entire browser window, not how much space a specific element on the page actually has available.

Picture a typical example. You have an elegant product card that's meant to display horizontally on large screens, with an image next to the text. A media query checks that the screen is, say, 1920 pixels wide, and tells the card to lay itself out horizontally. The problem arises if you've placed that card in a narrow column that's only 300 pixels wide. The media query doesn't know or care about this, so it stretches the card horizontally anyway. The result is distorted content that overlaps, spills over the edge, or squeezes into an unreadable mess.

Container queries look inward

Container queries solve exactly this problem. Instead of asking how wide the screen is, they ask a much smarter question: how much space do I have available right here, right now?

The component no longer adapts to the size of the entire window, but to the size of its immediate surroundings. That same product card will automatically become horizontal in a wide column, while remaining vertical and neatly arranged in a narrow column, regardless of how large the screen is. This is exactly the behavior any user would expect, and something many people have wanted for years.

Why this difference matters for your business

You might wonder why, as a business owner, you'd even care which design technique your web developer uses. The answer is simple: this choice directly affects three things that determine the success of your website.

1. Quality of the user experience

When content on your site adapts nicely to every space, visitors get a sense of order and professionalism. Distorted cards, overlapping text, and sprawling elements, on the other hand, create an impression of neglect and untrustworthiness. Visitors form an opinion about your business within seconds, and a poor layout on any device can permanently damage that impression.

2. Reusability and faster development

Container queries make it possible to build true components, meaning self-contained building blocks that work correctly wherever you place them. This means the same card, the same list, or the same form can be used on the homepage, in a sidebar, and in the footer without breaking. For your business, this translates in the long run into cheaper maintenance and faster addition of new content, since the developer doesn't need to manually adjust every element for every individual layout.

3. Better search engine rankings

Google takes user experience and layout stability into account when ranking websites. Elements that jump around, overlap, or cause sudden content shifts lower a page's score. A modern, well-built site that adapts correctly on every device therefore doesn't just lead to happier visitors, it also leads to better visibility in search results.

The most common mistake: container queries are not media queries

The main takeaway from the article is simple but important. Because container queries look almost identical to media queries at first glance, many people wrongly assume they serve the same purpose and work the same way. That's not true. Media queries are meant for changing the overall page layout, while container queries are meant for adapting individual components to their actual surroundings.

Using them incorrectly means a business pays for modern technology without actually getting its benefits, since the components remain tied to screen size instead of their real available space. This is exactly why, when choosing a partner to build your website, it's crucial that they genuinely understand how modern techniques work, not just that they know how to write the code.

What this means in practice

If you're thinking about a new website or a redesign of an existing one, it's worth checking a few things:

  • Does your content display correctly not just on mobile and desktop, but also at all sizes in between and in different parts of the page?
  • Are your site's building blocks designed as reusable components, or as one-off elements that need to be readjusted for every new layout?
  • Does your site use modern techniques supported by the vast majority of browsers today, or is it built on an outdated approach?

At Carpolab, we build websites to be ready for real life, meaning content that grows, different devices, and layouts that change over time. We use modern techniques like container queries where they bring real value, not just because they're new. If you'd like an estimate of what such a website would mean for your business, you can quickly check the rough scope using our calculator.

Frequently asked questions

Do I need to redesign my existing website right away because of container queries?

Not necessarily. If your site works well on all devices and doesn't have issues with distorted content, there's no reason to rush. However, it makes sense to consider container queries during your next major redesign or when building a new site, since they'll make maintenance easier and improve flexibility in the long run. If you're not sure what state your site is in, you can arrange a review with us through our contact page.

Do container queries work on older browsers?

Support today is very good, at around 94% of all browsers, which is more than sufficient for most Slovenian businesses. For the small minority of users with older browsers, a well-designed site always includes fallback behavior, so the content remains usable, even if it lacks the most advanced adjustments.

How do I know if my developer is using the right approach?

The key indicator is how your site behaves when you place the same content in different parts of the layout, for example in a wide column versus a narrow one. If components adapt properly and neatly everywhere, the approach is likely modern. If they break as soon as you move them elsewhere, it's often a sign of outdated thinking. For an independent opinion, you can consult an expert.

Conclusion

Container queries aren't just another technical novelty. They're a step toward websites that are truly flexible and sustainable. As the source article points out, media queries had their limits, and it's precisely those limits that this new technique now fills. For your business, this represents an opportunity: a website that works flawlessly everywhere builds trust, keeps visitors around, and ranks better in search results. The question is no longer whether it's worth building things the modern way, but whether you can afford not to.

Source: Smashing Magazine

More news

Read all

Every new article in your inbox

Every new article in your inbox

What will your site cost?

Answer a few questions and get a ballpark price in a minute. No sign-up.

Get a price
Fixed price agreed upfrontA clear timeline agreed upfrontThe site and domain stay yours