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?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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.
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?
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