July 17, 200818 yr Hey guys I need your opinion. I've been checking out people's style sheets, like yours Eggman, to see how they do different things (though I don't steal like other people that we've complained about). I've noticed that many of you have just one style sheet for both your formatting and your layout. Why is that? I've been of practice to make separate style sheets for format and layout. Now is that counter productive? Does that have a bad influence on the browser's load time. Or is it just personal preference. Let me know what you think
July 17, 200818 yr mmm, I have never really thought about separating format and layout into different style sheets although that could prove relieving for the painful times I've had going back through my CSS and trying to work out what does what! By seperating format and layout do you mean having one style sheet for changing things like font, font style, font size etc? and another for position and floats etc? My style sheets always start off neat and concise but as I get more and more into the development I end up just latching arbitrary bits of code onto the end of the document
July 17, 200818 yr Author Yea I have the font stuff and things not needed for layout in the format area and the layout stuff in the layout area. I like it much better that way I just want to make sure I'm not hurting myself by doing that.
July 17, 200818 yr If you can get it all in one file and keep the filesize down so that the whole CSS file fits in 1 packet then you should just use 1 file. Performance wise I am sure it will be better if 1 file is sent rather than 2-5 files.
July 17, 200818 yr Yea I have the font stuff and things not needed for layout in the format area and the layout stuff in the layout area. I like it much better that way I just want to make sure I'm not hurting myself by doing that. No reason not to do this. Only problem I can think of is if you want to for example specify different atrtributes for a <p> or an <h> or a <li> in a particular <div> as opposed to the global one defined in your formatting stylesheet. Where does this then go? Eg Global h1 { font-size : 1.4em; } goes in format sheet But in class called say myClass you want .myClass h1 { font-size : 1.2em; } Guess you could solve by simply still considering it formatting and adding to the format stylesheet but may get confusing?
July 17, 200818 yr For most sites a single stylesheet is more than adequate, mainly because it cust down on calls to just one file. If however you are running an extremely large and complex site then it often makes sense to have multiple sheets to separate out global from "local" styles, and to keep the overall download size smaller.
July 19, 200818 yr Yeah bluedreamer hit that one on the head, it's most important for bigger sites - however it is generally good practice to seperate stylesheets and then call them in with a master stylesheet. Smashing magazine did a good post on it here http://www.smashingmagazine.com/2008/05/02...ss-styleguides/
July 31, 200818 yr @EggMan: yeah.. i've read that article long time ago, and that is my favorite design blog
July 31, 200818 yr Personally I always use at least 3. I call a global which imports a reset and the layout.
July 31, 200818 yr This is something I've been puzzling about. And reading the above reckon splitting them is the way to go. The server-hit is minimal and in the long run probably easier to edit and manage and far more scalable.
July 31, 200818 yr Why would you use three stylesheets if you could just use one? It'd make it easier to find things if you didn't have to remember which file they were in... wouldn't it?
July 31, 200818 yr I normally just section mine off in one stylesheet. Something like: Body Headings Header Navigation Content Footer Obviously depending on the look of the site depends on what the sections are but you get the idea I sometimes will have a separate print stylesheet, and other times I might need to change a couple of things to make it IE6 or below compliant (but this is quite rare for me)
July 31, 200818 yr I normally just section mine off in one stylesheet. Something like: Body Headings Header Navigation Content Footer This is how I do it at the moment but often find myself scrolling up and down the screen when editing. Figure I'll try splitting the CSS up on my current project and see how it compares. I'm doing a full overhaul of our site from ASP to PHP/MySQL so figure might aswell overhaul the CSS whilst I'm at it
August 3, 200818 yr It can be a task looking through 5000 lines of CSS so I generally separate both my pages and CSS into: - main.css - forms.css - navigations.css - text.css - print.css etc etc, it goes on! I'm used to working with ridiculous amounts of files and find it more organised. Once you get yourself a pattern and know where you've put things (and where you naturally will) it's extremely easy and efficient to get right to what your looking for.
August 3, 200818 yr I do. Unless it's a very small project I use 3: reset.css layout.css style.css Reset is eric meyer's reset. Layout has all the structure, width, margin and padding stuff. Style has colours, font sizes, images etc. I've not been working like that for long, so am still deciding what goes where exactly, but I do find it easier to manage.
Create an account or sign in to comment