3 ms·
I haven't done CSS in about 6 years. So I don't understand why you'd ever use OP's version over yours?
by CWIZO 4y ago
I haven't done CSS in about 6 years. So I don't understand why you'd ever use OP's version over yours?
- jraph 4y agoFor * + * versus :not(:first-child), I guess it's a matter of style. Maybe they are a bit different in the specificity of the rule, I don't know. margin-block-* and margin-inline-* (versus margin-{top,right,bottom,left}) are more generic and take into account the writing-mode, direction, and text-orientation. https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inli... Notably, for instance, if you want to support both rtl and ltr languages, margin-inline-start (instead of margin-left) will behave correctly and put the margin at the correct side. If you ask me, it's a step towards specifying/conveying the intent and not hard-coding the look.
- chrismorgan 4y agoSpecificity is the difference: * + * is 0,0,0. :not(:first-child) is 0,1,0. :where(:not(:first-child)) would take it back to 0,0,0.