Forums

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?

#128565
JohnMotylJr
Participant

Without choosing option 1 || 2, personally my methodology is to use html elements as semantically as possible. If i need to style an element, i give it a class with a semantic naming convention, and if i need to target it with javascript, then i just give it an ID to hook. Now im not saying if you have 25 different <p> tags to give them all classes, just style that tag.

So, i guess my answer would be a little bit of 1 && 2. Give elements classes to style but still maintain semantic html.

All this is just how i roll, there are far more experienced folks here that may shoot down what i say or may support it. When in doubt, read documentation :)