The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS ‘DRY’ HTML vs OOCSS Approach? Better to have less HTML or CSS code? Re: ‘DRY’ HTML vs OOCSS Approach? Better to have less HTML or CSS code?


I guess the thing with big corporate sites is that there is no option: to keep maintenance easy and development cycles high it is better to give class to everything so that anyone can take on CSS and HTML, even if they’re pure developers with minimal CSS & HTML understanding. And it is kind of sad. Practically in those environments it often seems like there is no CSS optimization or cleanup to reduce syntax soup, only technical optimization (minifying & compression). I really dislike the resulting soup of divitis and classitis. You can even see regular HTML elements being replicated in JavaScript or jQuery (that are likely to have accessibility issues! Like select dropdown replacements with no keyboard support or if they have support it doesn’t work according to any expected standards…).

Of course I’m an extremist from the opposite side of the viewpoint. I really like the challenge of pushing CSS styling with minimal semantic HTML. I like to keep my HTML almost perfectly indented and thus readable. Everything has to have a reason to be declared, no things like `position: relative;` if it doesn’t have effect on anything else or `text-align: center;` if I already have a parent element that has it. Aim for perfectionism even if it isn’t always possible. It is time consuming but I enjoy doing stuff like that, and less surprisingly this has given me pretty deep CSS understanding – even if I lack “book knowledge” :)