This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > February 2006 > Optimizing CSS
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Hi -
I have a really massive stylesheet, and I want to trim it down to a
more reasonable size. So, what I'm wondering is if anyone can recommend
any decent online tutorials (preferred) or maybe a book about the
subject?
Of course, I can Google for "CSS optimization" and other such queries,
but that doesn't necessarily mean the tutorials are any GOOD :) --
Which is why I'm asking your opinions.
Thanx
| |
| Jim Moe 2006-02-07, 11:40 pm |
| Tony wrote:
>
> I have a really massive stylesheet, and I want to trim it down to a
> more reasonable size. So, what I'm wondering is if anyone can recommend
> any decent online tutorials (preferred) or maybe a book about the
> subject?
>
An URL would help.
In general:
1. The large size is often because every conceivable bit of style used by
a site is crammed into one file. Split out those sections that apply to
only a few pages and import those separately.
2. Use the "C" part of CSS, cascading. A lot of redundancy is because a
style is not cascaded for elements and separate classes are created where
none are actually required.
--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
| |
|
|
| Gérard Talbot 2006-02-07, 11:41 pm |
| Tony wrote :
> Hi -
>
> I have a really massive stylesheet, and I want to trim it down to a
> more reasonable size. So, what I'm wondering is if anyone can recommend
> any decent online tutorials (preferred) or maybe a book about the
> subject?
>
> Of course, I can Google for "CSS optimization" and other such queries,
> but that doesn't necessarily mean the tutorials are any GOOD :) --
> Which is why I'm asking your opinions.
>
> Thanx
>
Usually, the mistake people do is not understanding how CSS inheritance
works. So, they over-declare, over-define CSS rules. They also create
classes for everything possible, not understanding again how inheritance
works and when a CSS property is and is not inherited.
Also, they seem to ignore most of the CSS default values of elements.
"Classitis and Divitis
A common error of beginning CSS coders is to use far too many <div> tags
and class attributes (...) Ninety-nine out of a hundred times these
complicated structures are unnecessary."
Web Page Development: best practices
http://developer.apple.com/internet...bestwebdev.html
So, reducing DOM tree depth generally also reduces the need of a complex
stylesheet.
Excellent/recommendable resource is:
Style sheet master class: part 1 - writing perfect style sheets
http://www.richinstyle.com/masterclass/perfection.html
Also good (regarding parsing purposes) is:
Writing Efficient CSS
http://developer.mozilla.org/en/doc...g_Efficient_CSS
Gérard
--
remove blah to email me
| |
| Gérard Talbot 2006-02-07, 11:41 pm |
| Tony wrote :
>
> I have a really massive stylesheet, and I want to trim it down to a
> more reasonable size. So, what I'm wondering is if anyone can recommend
> any decent online tutorials (preferred) or maybe a book about the
> subject?
Also:
"Superfluous elements and classes
When starting out with CSS, it's common to make the mistake of using
unnecessary (X)HTML elements, superfluous classes, and extra <div>
elements. This doesn't necessarily mean that the code will be invalid,
but it counteracts one of the reasons of separating structure from
presentation; to get simpler, cleaner markup."
coming from
Developing With Web Standards
Recommendations and best practices
6. CSS
http://www.456bereastreet.com/lab/d...ndards/css/#css
Gérard
--
remove blah to email me
| |
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|