Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why is it (or was it) important to separate CSS from HTML? (softwareengineering.stackexchange.com)
11 points by RyanShook on June 21, 2018 | hide | past | favorite | 2 comments


Some frameworks have started to move away from the separation. Bootstrap has these ‘style’ classes like “text-center” and “pull-right”, which is essentially no different than doing “text-align: center” or “float: right” in the style attribute.

I think a good developer will avoid being dogmatic about style and content separation. My philosophy has been simplicity above all else. I will use a style class if I can avoid some ugly CSS selectors, and if I see a tag with a million style classes, I’ll wrap those up into a single class instead. It takes a bit of iteration to reach a simple solution, but it pays off when you have to return to the code in six months.


An interesting writeup is also linked there: https://keithjgrant.com/posts/2015/05/against-css-in-js/




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: