Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I currently am working on a project which has one large style sheet for about 20 pages. The style sheet contains some styles which are specific for certain pages. I'd like to break the style sheet up so there is one style sheet for each page with one master style sheet that handles everything generic. The reason I want to do this is so people can work on multiple pages without having to worry about who has that large style sheet checked out (I'm using TFS). Is this good practice?

share|improve this question
2  
Sounds to me like you need to read up the Cascading bit of css. *8') –  Mark Booth Aug 28 '12 at 14:29
add comment

3 Answers

up vote 3 down vote accepted

I'm not too experienced with this but in my opinion it really depends on your project and if it makes sense to do so.

It seems to me that in your case, with multiple people working on it, it would make sense but only if they really need to have access to the style sheet. The point of having a central style sheet is to keep the style consistent throughout each page. In projects I have worked on, the styling is usually predetermined or tuned up after the pages have been built.

If one page has just one element that needs to be customized, then I would just say use inline css to do so, since its really a special case. However if it gets to the point where a lot of items on that page need to be customized, then I'd say make a stylesheet for that page.

If the pages really differ enough to warrant each one having it's own style sheet in addition to the master style sheet then do so. But you should set a clear guide as to what the master style sheet should handle and make sure the individual style sheets don't conflict unless its truly necessary.

share|improve this answer
    
Like mentioned by gorjuce below, keep in mind scalability. If the project is going to be growing large, it may end up being a hassle to maintain the extra css files. In that case it may just make more sense to have one main one and use inline css to overwrite when needed. –  Andrew Hagner Aug 28 '12 at 15:50
add comment

You will absolutely lose 100+ hours fiddling with CSS if you split all your files up into a master, and a .css file for each page.

Use one stylesheet if possible. Assuming your master file will contain mostly resets, and CSS sanity checks, this will not be changing much. You need to use a nice set of comments to break up this one CSS file into distinguishable and labelled sections for your website.

I am not familiar with TFS, but if you are having check in/out problems, get people to branch the file and merge back? They will be working on their own seperate areas?

share|improve this answer
add comment

thinks scalability. Will you use your css later ? In an other project ? What will the result if i've a MVC application and my view requests me many files not delivred ?

In my opinion, define a css for a specific module + some main where basic html, body, h1, p, span , can be defined

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.