28-04-2023 10:00 via smashingmagazine.com

Write Better CSS By Borrowing Ideas From JavaScript Functions

I like to think of writing CSS, like writing functions that describe how your layouts respond to change. When we forget the principles of writing a good function, here’s some of what can happen:We lose time.
When we have to worry about side effects, changes take longer.
We create bugs.
My favorite example is an online store where the “Buy” buttons were hidden due to misuse of viewport units.
We build fewer features.
When changes are scary and time-consuming, they often don&rsqu
Read more »