SteveC
SteveC

Reputation: 16743

Will commented out CSS still have an impact/overhead of processing?

Will commented out CSS still have an impact/overhead of processing when the page is being rendered by the browser?

Or should we always aim to be as clean as possible?

Upvotes: 1

Views: 64

Answers (2)

Pepelius
Pepelius

Reputation: 1609

Comments (as well as spaces and line-breaks) increase the byte-size of the CSS-document, so basically if you're seeking to use a very well compressed files, you would want to minify the CSS and strip off all comments.

Upvotes: 1

BoltClock
BoltClock

Reputation: 723628

Inasmuch as the CSS parser has to determine where each comment starts and where it ends, yes, but literally no more than that.

You're better off worrying about conserving bytes — if you do worry about that, then all you have to do is put your CSS through a minifier that strips out all comments, and serve the minified stylesheet to your users while keeping the comments in your developer copy of your stylesheet.

Upvotes: 1

Related Questions