The Most Active and Friendliest
Affiliate Marketing Community Online!

“AdsEmpire”/  Direct Affiliate

Single CSS File or Multiple?

gilbertsavier

New Member
affiliate
Hi,
My site has several pages that are very different from each other.

Would it be better to use one CSS file or one for each page? (I have around 5 pages that are different from each other - the rest are the same.)

----
Thanks & regards
Lokananth
 
It depands there are many different reasons to choose one or multiple. Some of them are:

- if you are working on this website in team with at least 3-4 people it's good idea to make seperate css file for each subpage and one common with global data for all of them. This global css you can use by import and top of those specific ones. Then team members can work on their subpages simultanously and commit results to repository without merging.

- if you want to highly optimize your page load time and decrease number of connections it's good idea to use one file. In one file it's good practice to seperate groups of css classes with comments like /* header */ etc..

- if subpages look completly different and does not share common anchor classes, header classes, or common master page layout then it will be better to make seperate files in fact it does not take to much resources until you have mln of hits /day and it will be much easier to maintain.

Hope it will help somehow;)
 
It is difficult to set on CSS file for a site with a different layout. But master with a skill can do it. It is better to create single CSS file for whole site, however it is difficult but very effective. While having lot of CSS files you will be confused. To handle multiple CSS files is quite difficult. Further more, having single file will reduce your time work. Creating single file bags a lot of practice and practice, that is the only way to do it.
 
You can achieve everything that you need in a single css file by using classes. Make sure that you comment your stylesheet well so that if you do decide to make changes in a couple of years time then you will know what effect your changes will make.

Personally the only time I would use multiple stylesheets would be if I have to in order to render the site better on a mobile device.

Mike
 
I recommend going simple with one style sheet. When you start using multiple style sheets you can screw up by having CSS conflicts.

Yes this is a very good idea. It can get very difficult trying to keep track of everything. You can make comments in your CSS however and divide it up into sections so you know which CSS applies for which page.
 
It doesn't make a very big difference, but for organization purposes I would have one global CSS file and several other CSS files with styles for specific pages. It makes it easier to make changes in the long run.
 
For CSS that is used throughout the site use a separate CSS file and reference it. For CSS that is only used for specific pages use css within the page.
 
At the end of the day this is going to come down to personal style and preference.

Personally I generally use the following layout for my style sheets:

Master CSS file < Contains structure and generic styles, i.e. .clear class, CSS reset etc.

Then for each drastically different page I will have an indipendant stylesheet, so generally there will only be two style sheets that are compressed into the same file on launch.

If I have more than 3 style sheets (one master, 2+ page sheets) I will keep them seperate.
 
It is hard to set on CSS register for a site with a unlike layout. But master with a attainment can do it. It is improve to produce single CSS register for totally site.
 
if the formatting is the same,I recommend using 1 css file,it saves time effort and space. but if other pages differ from each other,you should make css for each page.
 
banners
Back