Container grid system using react CSS modules, full-width being overridden by content-grid
I was following the "A new approach to container and wrapper classes" and trying to hook it up to a react project using CSS modules. However, when I use my full-width class it gets overwritten by the content-grid class. Is there an incapability with React CSS modules and this type of layout? Or am I missing something?
Kevin Powell
YouTube
A new approach to container and wrapper classes
The wrapper or container is probably the most common design pattern around, but after coming across an article by Stephanie Eckles looking at how we can use a grid to emulate a container, and have simple breakouts — https://smolcss.dev/#smol-breakout-grid — I had an idea of how we could do this to completely drop the idea of containers, and then...
6 Replies
Can you share a minimal example of what you have?
Sounds like an issue with hierarchy/specificity maybe
Here is a maybe more "updated" version of how Kevins been doing it.
Its less direct child selectors, no sure if that might help ya
Sure, so I have my page layout where I have a div wrapping the entire content in a "content-grid" class. Then I'm setting up a component of navigation which is getting the class of "full-width".
Page loaded on:
Navigation component is:
The content-grid class itself is in a global.css file wrapping my entire application.
Nevermind, upon further investigation I am silly and didn't look at my code closely enough. Thank you, @b1mind!
So full-width inherits the grid template from content-grid
Oh no worries you got it ? 👏
I did indeed