getbem.github.io icon indicating copy to clipboard operation
getbem.github.io copied to clipboard

FAQ: What if some styles only apply to 1 element type?

Open mikeybinns opened this issue 3 years ago • 0 comments

For example, if I have button.button and a.button, the button a tag will have an underline. I know I could add this to the .button class, but then the button class would have to be more explicit and the more classes it has, the harder it might be to change in the future. Would it make sense in this case to add any resets to a.button instead of .button?

From:

/* all button styles */
.button {
    border: 1px solid;
    text-decoration: none;
}

to

/* actual button styles */
.button {
    border: 1px solid;
}
/* single element reset styles */
a.button {
    text-decoration: none;
}

mikeybinns avatar Mar 03 '22 15:03 mikeybinns