...

View Full Version : grouping length vs repeated CSS styles



ubh
11-28-2009, 07:05 AM
Ok here is where I always scratch my head, maybe some browser and cache/loading time guru could explain better or put some light on the situation.

Cutting down on repeated styles is a good way to cut down on both your CSS file(s) size and your sites loading time. GREAT but this now begs the question of how far should I go to cut down on repeated styles?

Take float:left; for example, this gets used a lot in my style sheet, now would it be wise to have a mile long grouping of each class and id that uses float:left; and then sum up the float:left; rule here.

I only ask cause in some cases it seems the amount of chars uses to declare the grouping of classes and ids out weighs the amount of chars used over the amount of times I repeat the float:left; style in the whole sheet.

So what am I making up for here then? What to do?

met
11-28-2009, 02:12 PM
well unless you're running on 28kb/s internet and have something in the region of >1mb CSS file then imo its' hardly worth worrying about

personally I'll group similar classes/id where possible. i.e h1,h2,h3

but any main "element" of my site I'll have in its own separate style, for readibility and future maintainability.

i.e what if you did have every floated left element in one style, then you are required to change one or two of them to float:right?

you'd have to go through the long list..find the one you want, cut it out, create a new class...etc

just makes extra work unnecessary in my eyes



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum