by chenster on 2/21/23, 6:23 AM with 83 comments
by zoul on 2/21/23, 7:16 AM
by jraph on 2/21/23, 8:06 AM
.stack > * + * {
margin-block-start: 1.5rem;
}
I got it immediately because I think I've been doing something similar for a while. I identified the problem it solves. I understand that if you haven't encountered the situation, it's probably hard to decipher.It reads like: apply a top margin to all direct children that are not the first one.
I write it like this:
.stack > :not(:first-child) {
margin-top: 1.5rem;
}
I probably should start using -block-start. I'll keep my selector though I think.I didn't know about the default value parameter of --var, I'll probably use it too.
by woahitsraj on 2/21/23, 7:09 AM
With all the recent criticism of tailwind, css-in-js, and other bloated frameworks I truly feel like 90% of projects could get away with a handful of sensible global styles or "classless css" and then aggressive use of components with scoped styles. You hardly ever need anything else
by ironmagma on 2/21/23, 6:46 AM
by adityaathalye on 2/21/23, 9:07 AM
By no means am I an expert, but I thoroughly enjoy writing CSS using techniques they teach in the book. Somehow, it helps me to think of CSS as a constraint programming system. Combinators are that --- layout constraint directives.
Architecturally, I really like the choice of pulling apart CSS in terms of structural definitions (Stack, Box, Switcher etc.), style definitions (applied to leaf nodes as far as possible), and global rules, ratios, and units (e.g. modular scale).
I think the system composes beautifully and lets me do a lot with a very small set of core definitions.
My personal site uses those techniques: https://www.evalapply.org/static/css/style.css
edit: formatting
by grishka on 2/21/23, 7:15 AM
*, *::before, *::after{
box-sizing: border-box;
overflow-wrap: break-word;
}
by lucas_codes on 2/21/23, 8:37 AM
We were begging for these features for years and it was a nightmare waiting for enough browser support.
by personjerry on 2/21/23, 7:16 AM
by asplake on 2/21/23, 7:16 AM
by shashanoid on 2/21/23, 6:45 AM
by just-tom on 2/21/23, 7:28 AM
by microflash on 2/21/23, 7:42 AM
It helps avoid bleeding issues of space which used to require :last-child / :first-child / :only-child overrides.
by firstfewshells on 2/21/23, 7:23 AM
by dickjo on 2/21/23, 8:04 AM
...but that's exactly how a sound design system SHOULD work. Structural components (containers etc) SHOULD be in complete control of child distribution. I simply cannot imagine what a nightmare having to manage margin at an atomic component level for everything would be instead of just spelling out a few container components for them all to live in.
Furthermore the resistance to using the two display types that utilise the gap property (flex + grid) is absolutely bizarre. No sane person would avoid these tools as web dev without them is messy and utterly maddening, so this resistance makes no sense at all.
by atoav on 2/21/23, 7:53 AM
When I was younger I also had a phase where I liked to do things like these because I could. Nowadays I do things in a way that doesn't waste my own (or other people's) time by being too clever
by ge96 on 2/21/23, 7:48 AM
border box, flex, the trick to make a square with ::before and content/padding 100%
by mariusmg on 2/21/23, 7:40 AM
A person which values their sanity would not write this in CSS.
by p2hari on 2/21/23, 12:00 PM
@tailwind base;
@tailwind components;
@tailwind utilities; :)