Container Queries in Grid environment

I know that you need to add a wrapper to grid items that is the container for an item to adapt to the track size of a grid when using container queries. I’m wondering if anyone knows of any methods to avoid needing to add this containing element and use the track itself as the container?
I’m not hopefully but wondering if anyone knows of something I’ve not seen before.
2 Replies
rctneil
rctneilOP3mo ago
Anyone any ideas about this?
Alex
Alex3mo ago
One reason for why you might not have received an answer is that your question is confusingly worded, and it sounds like an example of the XY problem: https://xyproblem.info. You can't use a grid area as the container for container queries, because a grid area is not a container. But more importantly, an element in a grid area will already fit to the size of the area as long as you don't have a fixed size or oversized content in it — that's what grids do. You shouldn't need a container query for that. When you say "you need a wrapper that is the container for an item to adapt to the track size", that implies there's something weird going on elsewhere in your code, or some of the terminology you've used isn't quite right. Explain what end result you're trying to achieve, and share an example of your current best efforts in a codepen.
Want results from more Discord servers?
Add your server