Hacker News new | ask | show | jobs
by AltruisticGap 2819 days ago
As usual maybe it is wiser to take the good parts from different approaches, rather than going "all in" with one ideology / methodology.

For my sites I find it useful to have a small collection of very generic classes. One common case that was annoying is how the spacing keeps changing as you move text and components around a page, and you end up fiddling with the rules all the time to adjust for how the top/bottom margins merge. No matter how "logical" it is, from a graphic design pt of view, the spacing is right when it looks right.

So I have a few very generic classes like this:

    .mb-0   { margin-bottom:0; }
    .mb-1   { margin-bottom:1em; }
    .mb-2   { margin-bottom:2em; }

     /* text */
    .txt-lg { font-size:1.4em; }
    .ta-r   { text-align:right; }
    .ws-nw  { white-space:nowrap; }
These are useful for making small adjutments to the layout. That said, going all in with atomic css doesn't make sense to me.
1 comments

I do the same. I have a scss file with a few margin and padding mixins that I can throw into the dom when I need to. Otherwise, I'll stick with updating all my buttons at once in my css `button` class.