Welcome our webmaster and SEO forum
Please enjoy the forum, contribute what you can, and wind up the Moderators!
Closed Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Single CSS File or Multiple?

  1. #1
    gilbertsavier is offline Member gilbertsavier is on a distinguished road
    Join Date
    Jun 2009
    Posts
    31

    Default Single CSS File or Multiple?

    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

  2. #2
    sdnsoft is offline Junior Member sdnsoft is on a distinguished road
    Join Date
    Feb 2010
    Posts
    6

    Default

    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

  3. #3
    Nikita is offline Junior Member Nikita is on a distinguished road
    Join Date
    Jan 2010
    Posts
    10

    Default

    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.

  4. #4
    Veledon is offline Junior Member Veledon is on a distinguished road
    Join Date
    Feb 2010
    Posts
    5

    Default

    I think it doesn't matter so much.

  5. #5
    Michael Walmsley is offline Junior Member Michael Walmsley is on a distinguished road
    Join Date
    Feb 2010
    Location
    Blackburn, Lancashire
    Posts
    10

    Default

    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

  6. #6
    futurehosting is offline Junior Member futurehosting is on a distinguished road
    Join Date
    Mar 2010
    Location
    Novi, Michigan
    Posts
    1

    Default

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

  7. #7
    CDDHosting is offline Junior Member CDDHosting is on a distinguished road
    Join Date
    Apr 2010
    Posts
    18

    Default

    Quote Originally Posted by futurehosting View Post
    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.

  8. #8
    Jay-S is offline Junior Member Jay-S is on a distinguished road
    Join Date
    Apr 2010
    Posts
    19

    Default

    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.

  9. #9
    surreypcsupport's Avatar
    surreypcsupport is offline Senior Member surreypcsupport is on a distinguished road
    Join Date
    Nov 2008
    Location
    surrey
    Posts
    569

    Default

    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.

  10. #10
    Phunk Rabbit is offline Junior Member Phunk Rabbit is on a distinguished road
    Join Date
    May 2010
    Posts
    2

    Default

    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.

Closed Thread
Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124