DEV Community

Discussion on: I'm a veteran UI developer, AMA!

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}}

Great question! I've always liked the separation of concerns: JavaScript lives in its corner and handles behaviour, HTML lives over there providing structure, and CSS does its pretty thing in another corner. It's partly how I learned and partly a orderly, 'everything in its box' mindset.

There's good reason for avoiding it too. If you've applied inline CSS here and there, it becomes difficult to hunt down weird styling issues or to make a more global change because you've overridden it in 10 other files.

Generally, I would avoid inline CSS as much as possible, same with conventions like '!important'. However, as is life, sometimes you can't avoid them and have to apply them. I think the skill is in applying them sparingly and for good reason, and that reason usually being that there is no other way (it does happen!).

I treat inline CSS like an emergency brake; useful in an emergency, but don't go pulling up at traffic lights using it!

Collapse
 
nombrekeff profile image
Keff

I could not agree more!