473,385 Members | 1,856 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,385 software developers and data experts.

Best practices; one huge stylesheet or multiple smaller ones

Currently working on a site that requires multiple different styles for all
kind of things (tables, link colors etc.) and am suddenly ;-) wondering what
would be the wise approach: have all these different styles in one huge
stylesheet, or separate into smaller css files and include only those that
are necessary. Target audience alos includes dialup visitors. Would anyone
be willing to share his/her opinion on this? Looking for the pro's and cons
of either approach.

Thanks,
John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_gr..._ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Jul 20 '05 #1
5 3316
Laiverd.COM wrote:
Currently working on a site that requires multiple different styles for all
kind of things (tables, link colors etc.) and am suddenly ;-) wondering what
would be the wise approach: have all these different styles in one huge
stylesheet, or separate into smaller css files and include only those that
are necessary. Target audience alos includes dialup visitors. Would anyone
be willing to share his/her opinion on this? Looking for the pro's and cons
of either approach.


Assuming several small files, with only the necessary files LINKed into
the HTML page:

* Easier to maintain because they're all seperate
* Harder to maintain because you can get conflicts between files

* Slower to download several small stylesheets (lots of connections)
* Not wasting time downloading unnecessary rules

I chose to use one large stylesheet. Then, I used Gzip compression on it.
The uncompressed stylesheet is 10046B, the compressed one 2561B. Most
browsers get the compressed one.

--
Matt
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #2
"Laiverd.COM" <sh******************@someserver.com> wrote in
news:41**********************@dreader2.news.tiscal i.nl:
Currently working on a site that requires multiple different styles
for all kind of things (tables, link colors etc.) and am suddenly ;-)
wondering what would be the wise approach: have all these different
styles in one huge stylesheet, or separate into smaller css files and
include only those that are necessary. Target audience alos includes
dialup visitors. Would anyone be willing to share his/her opinion on
this? Looking for the pro's and cons of either approach.


If your site's main page would only need a few of the files when split up,
then yes, go for it.

You might want also to look into ways to make the CSS file more efficient,
and less verbose. Try to remove any redundancies.

How many bytes could you save simply by removing superfluous whitespace?
By removing all line returns, all unneeded spaces, and all semicolons that
occur before a right curly bracket, I reduced my css document's filesize
from 1620 to 1314. That's a savings of 19%!
Jul 20 '05 #3
"Sam Hughes" <hu****@rpi.edu> wrote in
comp.infosystems.www.authoring.stylesheets:
How many bytes could you save simply by removing superfluous whitespace?
By removing all line returns, all unneeded spaces, and all semicolons that
occur before a right curly bracket, I reduced my css document's filesize
from 1620 to 1314. That's a savings of 19%!


Maybe, maybe not. IMHO what matters is download speed, and I'll bet
the cycle of HTTP request and serving up the content has enough
"fixed cost" that your 306-byte "variable cost" is no more than
statistical noise.

While I agree with you about removing _extra_ white space, CSS is
source code and as such needs some white space to be readable (and
therefore maintainable).

--
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/
Jul 20 '05 #4
Stan Brown <th************@fastmail.fm> wrote in
news:MP************************@news.odyssey.net:
"Sam Hughes" <hu****@rpi.edu> wrote in
comp.infosystems.www.authoring.stylesheets:
How many bytes could you save simply by removing superfluous
whitespace? By removing all line returns, all unneeded spaces, and
all semicolons that occur before a right curly bracket, I reduced my
css document's filesize from 1620 to 1314. That's a savings of 19%!
Maybe, maybe not. IMHO what matters is download speed, and I'll bet
the cycle of HTTP request and serving up the content has enough
"fixed cost" that your 306-byte "variable cost" is no more than
statistical noise.


Yes but when the same is done with a 10-kilobyte file, the savings are a
little over six times as substantial, but possibly more or less,
depending on how the OP spaces his CSS. The point is that _in_general_,
manically slashing and burning whitespace in a CSS document can
substantially lower file size.
While I agree with you about removing _extra_ white space, CSS is
source code and as such needs some white space to be readable (and
therefore maintainable).


It is possible to "compact" the CSS file and save it as a different name
before uploading it to the web server, keeping a perfectly readable copy
around for changes. And compaction could be automated.

Personally, I don't do it, because it's not worth it for me, and I don't
like serving inelegance.

--
Accessible web designs go easily unnoticed;
the others are remembered and avoided forever.
Jul 20 '05 #5
On 2 Aug 2004 21:27:09 GMT, Sam Hughes <hu****@rpi.edu> wrote:
Stan Brown <th************@fastmail.fm> wrote in
news:MP************************@news.odyssey.ne t:
"Sam Hughes" <hu****@rpi.edu> wrote in
comp.infosystems.www.authoring.stylesheets:
How many bytes could you save simply by removing superfluous
whitespace? By removing all line returns, all unneeded spaces, and
all semicolons that occur before a right curly bracket, I reduced my
css document's filesize from 1620 to 1314. That's a savings of 19%!


Maybe, maybe not. IMHO what matters is download speed, and I'll bet
the cycle of HTTP request and serving up the content has enough
"fixed cost" that your 306-byte "variable cost" is no more than
statistical noise.


Yes but when the same is done with a 10-kilobyte file, the savings are a
little over six times as substantial, but possibly more or less,
depending on how the OP spaces his CSS. The point is that _in_general_,
manically slashing and burning whitespace in a CSS document can
substantially lower file size.


With disk sizes as they are now, you'd probably have to save hundreds of
kilobytes to make it worth saving on file size. What I presume you are
thinking of is saving on transmission time. AIUI most server/browser
combinations nowadays support gzip data compression. And large numbers
of consecutive space characters happen to form an ideal target for data
compression. So "manically slashing and burning whitespace" is probably
a complete waste of time.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #6

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

Similar topics

1
by: louis nguyen | last post by:
Hi All, My question is what are the best practices for administering large DBs. (My coworker is the DB administrator. I'm more of the developer. But slowly being sucked in.) My main concern...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
3
by: Brian | last post by:
Can any one direct me to sources for best practices of field types and sizes to use for commonly used information such as address, names, city, business names .... Thanks, Brian
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
0
by: David Helgason | last post by:
I think those best practices threads are a treat to follow (might even consider archiving some of them in a sort of best-practices faq), so here's one more. In coding an game asset server I want...
7
by: Rhino | last post by:
I thought I'd take a second to step away from a specific problem and ask a general question about best practices; I know some of the people here are very experienced with CSS. Given the need to...
10
by: Mike Logan | last post by:
I am using the "contract first" design methodology. Contract First is design the WSDL first then design the server and client. However I must design my XSD/XML Schema before anything. I am...
55
by: Steve | last post by:
I have to develop several large and complex C++ hardware test programs that should work under DOS, most likely with 32-bit DOS extender. Development workstation OS would be Microsoft XP. Quite some...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.