Home > OS >  Are inline styles bad?
Are inline styles bad?

Time:11-22

React's Styling and CSS documentation attempts to answer the question Are inline styles bad? with a brief suggestion that "CSS classes are generally better for performance than inline styles". But no further explanation is offered.

Strictly from a performance perspective, and politely ignoring the obvious cost of shipping duplicate CSS declarations, how bad exactly are inline styles compared to CSS?

CodePudding user response:

I think inline styling not bad always but most of time it's better not to use inline style because of these following reason:

  1. it's overwrite the other style you use in CSS file for that element
  2. can't use custom responsive style in CSS file for that element
  3. if you use a style in many tags and you want to change it you must change all of them but if you use a class it cost only change the class style

CodePudding user response:

I also add that for me it's the most inconvenience: performance. Inline styles make your pages more big so that bandwidth and load time grow up and affect also on SEO.

  • Related