Container Query Best Practice
I hope you’re having a good week so far!
I’ve been playing around with container queries lately, and so far, there’s only one best practice that I would recommend.
Whenever you use Container Queries, make sure you wrap the element with a Container element.
So your HTML should look like this:
This container should not be the element that creates a grid in your layout.
So don’t do this.
Do this instead
I explain what this all means and why we should do this in today’s article.
It’s a simple read — but a crucial read — if you’re playing around with container queries. I almost make a huge mistake when I was messing around with the HTML structure!
Have fun with it and let me know what you think!
Stay awesome,
Zell