Hacker News new | ask | show | jobs
by mewpmewp2 1757 days ago
It might be subjective, but I disagree, for me it would be easier to reason, read and maintain the first way, preferably with scss, so you nest the last child. Maybe it is because that's the pattern I have most faced, though.

And I think definitely avoid li + li. It wouldn't be immediately obvious at all for me if I saw that, what the intention is.

1 comments

> I think definitely avoid li + li. It wouldn't be immediately obvious at all for me if I saw that, what the intention is.

Nothing unfamiliar is obvious. As with any language, get to know the capabilities of CSS better and it will feel familiar. The article is right that for spacing, the `gap` property on the parent makes more sense but hasn't been around long enough, we need some more older browsers to age out (especially when used with Flexbox).

Yeah, but it wouldn't be just me, point of writing readable code is so that as many developers as fast as possible would understand what is going on. So in this case I think using the pattern that is most commonly used is the best thing to do.

I've done web for more than 7 years and I still immediately wouldn't recognize why someone has used selectors in such manner (li + li). Just obfuscates things IME.