Forum Moderators: not2easy

Message Too Old, No Replies

CSS files,inline and in page.

         

optik

9:27 pm on Feb 12, 2010 (gmt 0)

10+ Year Member



I've seen many sites encourage storing as much if not all CSS information in one central file however I often find it more sensible not to do this this, especially for larger sites.

So is multiple CSS files not a problem?

I also find inline CSS useful for fine tuning designs, it seems pointless to add these styles to a class when they will only be used once on the site.

I am now also starting to think about using in page classes more for styles that are repeated but only on that page.

Is the one central CSS file idea right for some reason I'm overlooking?

abushahin

12:25 am on Feb 15, 2010 (gmt 0)

10+ Year Member



A good reason to have an external css is because if your site has more than one page and uses most of the styles, on the first request by the user, that css would get cached saving you load times every byte counts, whereas having inline styles makes your page bigger and that ms extra to load. a good plugin for firefox to analyse page load speeds is page speed. can be useful.

optik

2:24 am on Feb 15, 2010 (gmt 0)

10+ Year Member



I understand if the styles are going to be used on more than one page they should go in the main file, but for something that is page specific then inline or in page seems to make more sense.

bzgzd

10:00 am on Feb 15, 2010 (gmt 0)

10+ Year Member



One reason for having less css files is performance improvements because of less http requests.

Combining files... similar to "combining" images to sprites.

http://developer.yahoo.com/performance/rules.html

[code.google.com...]

optik

5:49 pm on Feb 15, 2010 (gmt 0)

10+ Year Member



I agree loads of CSS files is not desirable which is why I'm more inclined to use inline and in page styles now for things that are clearly page specific.

bzgzd

2:08 am on Feb 16, 2010 (gmt 0)

10+ Year Member



Google also suggest not using inline styles because of browser rendering performance.

[code.google.com...]

tangor

5:12 am on Feb 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For site wide css a single external file is best practice and also reduces the amount of time spent programming. HOWEVER, for odd css on single pages there's nothing wrong with including it in-line. Both work, and I use both.