I watched this presentation about object-oriented css , but I think that I either do not understand it correctly, or do not understand the benefits using OO CSS:
HTML example:
<div class="border-1 bg-2 color-1 font-1"> </div>
CSS example:
.border-1 { border: 1px solid red; } .bg-2 { background: yellow; }
I see the advantage in that you can quickly change styles for several elements, for example, the ability to switch the color scheme will be very useful.
But in fact you are defining the style / appearance of the HTML, or at least part of it. Of course, this is better than using the style attribute, because you can still exchange styles for a set of groups.
The point is that you define style groups inside HTML, but I found out that you have to create “logical” groups inside HTML (for example, class="nav-item" / class="btn submit-btn" ), and CSS is completely applies style and determines which elements belong to each other from a "stylistic" point of view (for example, .nav-item, .submit-btn { background: red; } ).
Perhaps I did not completely understand this concept. However, I still don't know a good way to build my CSS.
fishbone
source share