[thelist] CSS..

Parshadi Saraiya saraiyap at yahoo.com
Wed Feb 1 20:27:27 CST 2006


Thanks. That does help lot! 
I can now make a valid case of breaking down the style sheet.

-Parshadi.



Todd Stadler <tstadler at gmail.com> wrote: Hello,

On 2/1/06, Parshadi Saraiya  wrote:
> I would like to figure out the advantages and disadvantages of using multiple style sheets > on an application. According to me it is a nice way to organize but, at the same time it
> can be confusing to keep track of all the files!

Assuming I understand your current situation, you have one style sheet
that is used for every page on your site (not simply one style sheet
per page). The advantage to this approach is that, once that CSS file
is downloaded by the browser, it (hopefully, assuming proper browser
cache usage) does not need to be downloaded again for any other pages
that are viewed on your site.

The disadvantage to this approach depends on how much of the style
sheet is used by any given page. If most pages on a site have similar
layouts, use similar classes and id's, and so on, then there's not a
lot of downside. However, for sites that I have worked on, this tends
not to be the case, and putting everything in one style sheet would
result in any given page using, say, 10% of the single stylesheet. If
the stylesheet is big enough, this means that the first page a user
hits could load rather slowly, and for no good reason, since that page
only uses 10% of the file it's downloading.

The advantages to breaking up stylesheets are the ability to reuse as
much as you can from the cache, thereby incurring the smallest
download for any given page.

For sites I have worked on, there tend to be some things I want to do
for some tags no matter where they occur (e.g. remove margins/padding
on , put margin on the bottom of , set default text size and
line height, and so on). Those go into my general style sheet that
every page loads.

But if a site has distinct content types -- say, photo galleries in
one section, and text-heavy articles in another -- it would make sense
to create distinct style sheets for each of those sections, so that
the photo gallery pages aren't needlessly downloading article-related
CSS, and vice-versa.

I suppose it can seem tricky to keep track of multiple CSS files, but
if you name them appropriately and group the style rules thematically,
it really isn't that hard.

Hope that helps!

--
Todd Stadler, tstadler at gmail.com
"You try to warn them that the world's gone mad, but they won't listen
to you" -Snoopy
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 



		
---------------------------------
 
 What are the most popular cars? Find out at Yahoo! Autos 


More information about the thelist mailing list