user625860
user625860

Reputation:

Why is CSS Formatted Without Whitespace?

Sometimes when I look at style sheets of big websites (even this one) the css code is completely formated (or however you call it), like this: http://cdn.sstatic.net/stackoverflow/all.css

Is this just the result of a style sheet beeing generated by a CMS ?

Upvotes: 0

Views: 66

Answers (3)

Virendra
Virendra

Reputation: 2553

It can be generated by CMS or manually. Removing all the tabs and spaces reduces the size of the file, thereby loading it faster an inturn can make a site faster.

Upvotes: 1

Jonatan Hedborg
Jonatan Hedborg

Reputation: 4432

It's probably generated on the fly from a more scriptable/dynamic/dry layout language, and there is simply no reason to add the whitespaces since non-one should be reading them, and it would only add to the file-size.

Upvotes: 1

Ry-
Ry-

Reputation: 224942

I call it "minified", and I think that's the general term. But the reason is to reduce loading times. All those useless spaces and comments still count as bytes, and sometimes you can have more spaces and comments than actual effective characters! (It also obfuscates the stylesheets, although that's really pointless as spaces can easily be restored with whatever formatting you need.)

Upvotes: 4

Related Questions