473,388 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Optimizing CSS

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

Feb 1 '06 #1
5 1310
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)
Feb 1 '06 #2
> 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?


I have found http://flumpcakes.co.uk/css/optimiser/ to be useful - the
output generally needs a little bit of tweaking, but it's a great start.

--
Mark Parnell

I give up:
http://blinkynet.net/comp/uip5.html
Feb 1 '06 #3
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/...estwebdev.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/docs..._Efficient_CSS

Gérard
--
remove blah to email me
Feb 2 '06 #4
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/de...dards/css/#css

Gérard
--
remove blah to email me
Feb 2 '06 #5
Thu, 02 Feb 2006 07:17:31 -0500 from Gérard Talbot
<ne***********@gtalbot.org>:
"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/...estwebdev.html


I'm not sure I'd put a lot of faith in anything that page says since
it recommends using tables for layout. No way can that be called
"best practices" IMO.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Feb 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andreas Paasch | last post by:
I've finally gotten my nice little system working and it's gone live. Now, I spent time optimizing my code and adding a little smart functionality here and there, based on needs and simplicity. ...
6
by: A Future Computer Scientist | last post by:
A question: Is it really important to think about optimizing the native code or optimizing it for P Code? Or does the code you write make a difference?
4
by: J. Campbell | last post by:
From reading this forum, it is my understanding that C++ doesn't require the compiler to keep code that does not manifest itself in any way to the user. For example, in the following: { for(int...
32
by: Bob | last post by:
Can anyone point me to a place where I can obtain the Microsoft C/C++ Optimizing Compiler Version 7.00. It was distributed about 10 years ago on floppy diskettes. I had a valid license but...
2
by: Brian | last post by:
In particular, this question goes out to the Microsoft C++ development team. Back in June, Ronald Laeremans posted the following message. Has the optimizing compiler been included with the...
4
by: Flashman | last post by:
A little confusing with setting up optimizing options with 2003 .NET. Under the Optimization Tab. if you set to /O1 or /O2 is the program ignoring the settings for Inline Function expansion,...
3
by: Nick Gilbert | last post by:
Hi, I have to send an array of prices for a list of products over XML. Currently my XML data looks like this: <ArrayOfProd> <Prod Code="productcode001"> <Prices> <P F="2005-01-01"...
24
by: Richard G. Riley | last post by:
Without resorting to asm chunks I'm working on a few small routines which manipulate bitmasks. I'm looking for any guidance on writing C in a manner which tilts the compilers hand in, if possible,...
6
by: peter_k | last post by:
Hi, Last time i'm interested in optimizing small c programs. On my studies we are sending the programs using the web interface to online judge. The person who will wrote the faster program get...
0
by: Miguel Perez | last post by:
Please critique this tail call optimizing decorator I've written. I've tried to fix the pitfalls of other proposed decorators, and the result is this one that supports mutual recursion, does not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.