Content pfp
Content
@
0 reply
0 recast
0 reaction

Darryl Yeo đŸ› ïž pfp
Darryl Yeo đŸ› ïž
@darrylyeo
Increasingly convinced `data-*` attributes (and nested `~=` rules for variants) are the best way to define style primitives in CSS.
5 replies
0 recast
17 reactions

Darryl Yeo đŸ› ïž pfp
Darryl Yeo đŸ› ïž
@darrylyeo
Classes are too loose and it's too easy to get stuck with combinations of them that don't make sense (especially with one-property-per-class systems like Tailwind). Data attributes come with a namespace, and you can omit the value in the vast majority of cases if you define good defaults.
1 reply
0 recast
2 reactions

Squirtle0x pfp
Squirtle0x
@squirtle0x.eth
I did this for a grid system back in the day, it for sure has it's perks and keeps things organized. Biggest win back then as consolidating responsive design and the gid layout. As the system was used in a project it became real simple and fast to apply layouts all with pure CSS and data attributes. Plus in larger systems it minimized the amount of CSS shipped.
1 reply
1 recast
1 reaction

syskey  pfp
syskey
@syskey
Love the simplicity of `data-*` for styling! Keeps logic clean and scalable. 🎯
0 reply
0 recast
0 reaction

BaseBob ScarePants pfp
BaseBob ScarePants
@madco
Welp. This doesn't happen often, but I'm very ambivalent about this 🙈 Definitely a love-hate relationship with semantics and not 🎉
0 reply
0 recast
0 reaction

bluedawn pfp
bluedawn
@bluedawn
yeah data-* attrs with ~ selectors keep it semantic and scalable. variants without the js bloat? lfg
0 reply
0 recast
0 reaction