3 ms·
w.r.t. avoiding div and class, how do you make sense of the element <-> rule mapping? There's definitely enough specificity to make such a mapping, but I just e
by andreareina 10y ago
w.r.t. avoiding div and class, how do you make sense of the element <-> rule mapping? There's definitely enough specificity to make such a mapping, but I just end up with a big bowl of spaghetti.
EDIT: I guess I'm mostly talking about class, HTML5 semantic elements takes over much of the utility of divs in this usecase.
- yellowapple 10y agoI usually just base it on whether or not an element is a direct child of some other element. For example, the header of the page itself will usually have a different style than the header of an article or aside or something, so I can use CSS' child selectors for that. This often does indeed result in a bowl of spaghetti, but said bowl is in CSS rather than HTML. Things like SASS/SCSS help tremendously.