6 replies [Last post]
seb
Offline
Enthusiast
Last seen: 13 years 27 weeks ago
Joined: 2003-09-20
Posts: 208
Points: 0

Do you put all the CSS for an entire site into one file? If so how do you structure it. If not how do you structure the multiple files?

Tags:
Anonymous
Anonymous's picture
Guru

One file or many files?

Click here for a really cool site to answer your questions. Laughing out loud

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 23 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

One file or many files?

I can answer for moi. And that depends, I would say on how many people you're willing to attract...

Ok, I'm swedish so I'm having a tad problems with the language here...Hehe. Say you wanna have a buttonmenu, and some other features at your site, that you know from scratch all browsers won't handle (and you want everyone to be able to look at your site) then you have to do browser specific cssfiles (hack's don't work all browsers I think...At least it's a bit difficult), and perhaps import them...

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

seb
Offline
Enthusiast
Last seen: 13 years 27 weeks ago
Joined: 2003-09-20
Posts: 208
Points: 0

One file or many files?

Triumph wrote:
Click here for a really cool site to answer your questions. Laughing out loud

Yeah, that was, er, no help at all as far as I can see... cheers Tongue

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 27 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

One file or many files?

How odd.

Anyway. I have a 'generic' CSS file, with stuff that applies to all pages on my site - the basic layout. I then have individual ones per page, with specifics; table styles, any other layouts only used on that page, etc etc...

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 4 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

One file or many files?

Hi seb,
Usually I try to break the files up into logical sections or group styles based on element types.
The choice to use multiple files or keep the styles together can be based on the size or amount of style rules.
Something along the lines of:
Layout
Links
Lists (menu etc)
Forms
General styles

Then you can also separate styles for older browsers if you wish.

Hope that helps

larmyia
Offline
Elder
London
Last seen: 11 years 46 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

One file or many files?

So, in your html would you put something like this:

<link rel="stylesheet" type="text/css" href="main.css" /> *for everything*
<link rel="stylesheet" type="text/css" href="index.css" /> *for one page*

and also...isn't it common practice to develop your stylesheet so it fits every browser? or is this if you are doing something specific and unusual that you really want on your site (but know it won't work in certain browsers)? In that case, why doesn't everyone have say, a separate file for IE/Mac? or do they already? or is this a bad practice?

furthermore, how do you tell the browser which stylesheet to pick?

thanks

larmyia