Attila Vágó
May 16, 2023

--

I believe so, yes. A lot of the abstraction already comes from the HTML tags, so using all the appropriate ones, not just <div> and <p> tags everywhere already solves much of that and ensures your code is accessible. At that point you just write CSS based on the tag, so wherever you put that tag, it will look the same.

Where you need something more than that, good class names specific to your app are easy to come up with. You also have the option to rely on nesting to get some abstraction. Say for instance your <p> tags inside a <li> tag might need a slightly different look, so just do a li p rule or even a li > p.

Hope that helps.

--

--

Attila Vágó
Attila Vágó

Written by Attila Vágó

Staff software engineer, tech writer, author and opinionated human. LEGO and Apple fan. Accessibility advocate. Life enthusiast. Living in Dublin, Ireland. ☘️

No responses yet