DEV Community

Discussion on: 7 CSS Tips To Save Your Sanity

 
okeeffed profile image
Dennis O'Keeffe • Edited

If we need to classify buttons as buttons in HTML

Ahhh if you are referring to the examples given for the BEM and Outside In sections? They’re just trivial examples taken directly from their “Hello, World!” examples on their website to illustrate their approach.

But if by that you actually mean declaring HTML button tags, then that would just be semantically correct HTML5.

Thread Thread
 
lkw23002894 profile image
LKW • Edited

Indeed. Outside-In is reasonable, at least it doesn't interfere with anything that is of no concern.

I was talking specifically classification, i.e. the class attribute. This is what we were given to work around limitations of HTML, when we need to expand on the basic HTML taxonomy. For example we identify that our design has more than one kind of something, we have to assign new names and explain the difference, this is the classification process. Then at scale, users know what classes there are and more importantly, why there are more than one, and understand the rules when to use which class.

So it's BEM that's crazy. We don't want crazy if we care about our sanity. Why would we want to classify all our buttons as 'button'? That has no meaning and it's just extra work. We don't need to classify elements according to their state any more, either, that's certainly something from decades ago. We have attribute selectors for that, aria attributes are really good for that, too.