How to style sub-elements for modified parent Element? #321
Unanswered
Juggern4ut
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use BEM in all my project and I love the readability of the resulting SCSS code, but from time to time I run into the following Problem:
Suppose I have this HTML
Using the following SCSS works great:
But how would I write my SCSS if i want the title, aswell as the cta to have a different styling, based on the modifier of the card? (In this case card--special)? I don't think it is helpful for the readability to have the modifier on the title aswell as the cta. Or did I understand a core concept of BEM wrong?
I would love a solution where I could encapsulate it within the .card{...} block so the whole Styling is contained within it.
Beta Was this translation helpful? Give feedback.
All reactions