3 ms·
Why does it seem like no one knows anything about CSS? BEM, "Functional" CSS, all this nonsense simply because nobody know about the child selector as opposed t
by Yahivin 8y ago
Why does it seem like no one knows anything about CSS? BEM, "Functional" CSS, all this nonsense simply because nobody know about the child selector as opposed to the "any descendant" selector. (Maybe because it wasn't supported in IE6 and we're still reeling from that to this day...)
Take ten minutes and learn. Here's some tips:
Attribute selector:
button[disabled]
background-color: gray
Modifiers are just classes, never have disconnected .some-classes floating around. Keep them scoped to their element :
button.large, a.button.large
font-size: 2rem
Child selector:
profile-card > h2
font-size: 1rem
margin: 0
Everyone forgets to put in the alligator and then complains that their ridiculously nested markup gets out of control. This way a card can contain _anything_ and not have to worry about stomping its styles.
Semantic elements:
profile-card
display: block
profile-card.active
background-color: green
You don't need to be limited by span/div-itis. It's 2018 go wild.
Pro-tip:tm: try learning CSS before creating or adopting a CSS "framework" to solve problems that CSS already solves.
Hope this brief rant saves a life or two. Hang in there people.