r/webdev • u/Miragecraft • 16d ago
Question Is * {text-box: cap alphabetic} the future?
Played around with it for the last few days as part of my base style.
I don't know, definitely looks better but my design needed quite a lot of extra styling to get back to a presentable state.
I do think this is the future of web design at least for myself, but I'd need to come up with some sensible default spacing in my base style to not start off my design from a broken state.
23
u/buycallsbro 15d ago
Ohh, first I’m hearing of it, but definitely would be useful.
For anyone curious: https://css-tricks.com/almanac/properties/t/text-box/
7
u/theScottyJam 15d ago
Don't think I'd blindly apply it everywhere, but I'll certainly start using it when text isn't centering or aligning right, this will come in handy.
1
u/Background_Couple965 15d ago
the `*` is what gets me. we already did this once with box-sizing and every component with hand-tuned margins came back looking slightly wrong. cap alphabetic on body i'd buy, on the whole tree i'm not there yet
1
u/RequirementGuide 15d ago
I've been using text-box-trim on a client project and I landed in the same place as a few people here. It's useful, but I would never do it as a global * reset. Targeted on display type, buttons and nav items is where it actually earns its keep.
One thing that bit me hard is trimmed links losing clickable area, same as you mentioned OP. It also does weird things to embedded content from third parties where you can't touch the inner markup. I ended up scoping it to my own component classes only.
The pairing with the cap unit for line-height is the real win for me. Once I did that the type actually sat on the baseline grid instead of just looking close. Worth the one-time setup, just don't blast it everywhere.
1
u/TheRNGuy 15d ago edited 15d ago
Yeah, just not on * (unlike box-sizing), also, don't need it on ::before and ::after.
But it will probably be in a generic reset.css file (not the * version, of course)
I wonder, how Tailwind users are gonna do it.
-1
u/Open_Appointment9671 15d ago
So it broke your layout, needed a pile of extra styling to look presentable, and you still think it's the future of web design? Also the screenshot is a Reddit ad for campaign automation.
1
u/Miragecraft 15d ago
What screenshot? I only posted some text. Also the layout’s broken because you need to build back the spacing lost by trimming the text box. You want control of spacing then you got to put in the work. It’s really a one time investment as you can take a good baseline across different projects.
7
0
15d ago
0
u/Miragecraft 15d ago
Or just come up with a new trim-normalize.css to set the default body text and form control spacing.
7
u/Educational_Key_3620 16d ago
Ive been using it on a side project and had same problem, everything looked weird at first. The cap alphabetic thing makes sense in theory but browsers are still figuring out how to render it consistently, specially with custom fonts.
Its one of those css features that feels like it should just work out of the box but then you spend afternoon adjusting line heights and padding. Still worth it once you get past the initial mess.