The benefit of classes over applying a style to every element type is that you're now able to have different looking things that use the same HTML elements.
For example you might want to use a list for a left-hand menu and another one for a top or bottom menu, but they're obviously not supposed to look the same.
Bootstrap takes a very expressive approach by pretty much skipping inheritance completely and assigning a class to every element.
Other CSS Frameworks will have classes that apply a certain style to all nested elements.
For example UIKit (the CSS Framework, not the Apple UI one), provides you with a uk-child-width-1-3 class that makes all directly nested elements take up one third of their parent's width unless they have their own class or styling.
Freelance tech writer and community-builder Self-teaching web development/design, using online resources. Blogs about JavaScript, mindset, and my journey.
The benefit of classes over applying a style to every element type is that you're now able to have different looking things that use the same HTML elements.
For example you might want to use a list for a left-hand menu and another one for a top or bottom menu, but they're obviously not supposed to look the same.
Bootstrap takes a very expressive approach by pretty much skipping inheritance completely and assigning a class to every element.
Other CSS Frameworks will have classes that apply a certain style to all nested elements.
For example UIKit (the CSS Framework, not the Apple UI one), provides you with a
uk-child-width-1-3
class that makes all directly nested elements take up one third of their parent's width unless they have their own class or styling.This makes sense, and is very true. Thank you!