473,325 Members | 2,870 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,325 software developers and data experts.

single or multiple CSS files

Hey everyone, I am looking for your thoughts and opinions.

Is it preferable to have one css file containing all the style information
or break it up into multiple imported files for different types of
formatting. For example, one file for page layout related items and
another for text formattion?

I have seen different combinations on different pages, and am wondering
which people find is easier to maintain. Being from a coding background
myself, I like to keep related things together, and move the rest to a
different file, or files. Also being from a coding background, I'd prefer
to learn by reading about others mistakes than duplicating them myself.

Thanks, Carolyn
Jul 21 '05 #1
4 5126
in comp.infosystems.www.authoring.stylesheets, Carolyn Marenger wrote:
Hey everyone, I am looking for your thoughts and opinions.

Is it preferable to have one css file containing all the style information
or break it up into multiple imported files for different types of
formatting. For example, one file for page layout related items and
another for text formattion?
Usually, it makaes sence to have everything in one file, and maybe
supporting stylesheets for stuff that is only used on subset. If you have
lots of stuff in these files for different media, split styleshet to
media specific ones.

It makes no sence to use many stylesheets for every page if they are
always same, as it will end up more likely FOUC, as one of the files is
bound to be delayed. Especially if your server is not that fast, and
other end has suboptimal network preferences. Same if you have import
rule in your external stylesheet...
I have seen different combinations on different pages, and am wondering
which people find is easier to maintain. Being from a coding background
myself, I like to keep related things together, and move the rest to a
different file, or files. Also being from a coding background, I'd prefer
to learn by reading about others mistakes than duplicating them myself.


You may do that as well, just compine the small sheets on one file before
serving them up.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #2
On Thu, 03 Mar 2005 22:02:39 +0100, Lauri Raittila wrote:
in comp.infosystems.www.authoring.stylesheets, Carolyn Marenger wrote:
Hey everyone, I am looking for your thoughts and opinions.

Is it preferable to have one css file containing all the style information
or break it up into multiple imported files for different types of
formatting. For example, one file for page layout related items and
another for text formattion?


Usually, it makaes sence to have everything in one file, and maybe
supporting stylesheets for stuff that is only used on subset. If you have
lots of stuff in these files for different media, split styleshet to
media specific ones.

It makes no sence to use many stylesheets for every page if they are
always same, as it will end up more likely FOUC, as one of the files is
bound to be delayed. Especially if your server is not that fast, and
other end has suboptimal network preferences. Same if you have import
rule in your external stylesheet...


My thoughts were along the lines of one style sheet containing layout and
positioning and a second containing styles and colours. The idea being
that some pages on the site will look best in a multi-column format,
others, like a gallery might need a different layout. I would however
want the same style and colours throughout the site.

I like your point on one file coming in quickly and another slowly, and
screwing up the layout in the meantime. To extend on it, each file that
gets sent needs it's own handshaking overhead. That impacts directly on
the download speed to anyone, with a more noticeable effect on slower
connections. The other thing is the use of additional server resources to
deal with the additional file request.

From a purely technical side of things, minimizing the number of files,
speeds up transmission and reduces server resource usage. Two very good
things.

I suppose I could have two or three document layouts within a single
stylesheet, just have to ensure that they are well documented, so I know
what's going on the next day I open the file.

Thanks for you input. I think I have reached my decision... at least for
now. :)

Carolyn

Jul 21 '05 #3
Carolyn Marenger wrote:
Hey everyone, I am looking for your thoughts and opinions.

Is it preferable to have one css file containing all the style information
or break it up into multiple imported files for different types of
formatting. For example, one file for page layout related items and
another for text formattion?

I use one file for the basic layout, the styles that are common to the
site as a whole. There a separate CSS files for some pages that have
special requirements that are not needed anywhere else, or are used only
in a few other places.
Having the multiple, smaller files keeps the size of the main CSS file
manageable.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 21 '05 #4
I do this as well. One main css and if I need to tweak the style on a
subsection, I import the main and define the new styles in a new sheets.

In addition, when I develope I usually import a "reset sheet" to the
main. Basically this is a sheet which strips the default styles and
looks something like this:

body, h1, h2, h3, h4, h5, h6, p, em, a, a:hover, a:link, a:visited,
a:hover, div, table, td, tr, ul, ol, li, img {
background: transparent;
border: none;
border-style: none;
border-width: 0px 0px 0px 0px;
color: #000000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 9pt;
font-style: normal;
font-weight: normal;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
text-align: left;
text-decoration: none;
list-style: none inside none;
}

This gives you a clean slate to work on :)

Jim Moe wrote:
Carolyn Marenger wrote:
Hey everyone, I am looking for your thoughts and opinions.

Is it preferable to have one css file containing all the style
information
or break it up into multiple imported files for different types of
formatting. For example, one file for page layout related items and
another for text formattion?

I use one file for the basic layout, the styles that are common to the
site as a whole. There a separate CSS files for some pages that have
special requirements that are not needed anywhere else, or are used only
in a few other places.
Having the multiple, smaller files keeps the size of the main CSS file
manageable.

Jul 21 '05 #5

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

Similar topics

4
by: googlinggoogler | last post by:
Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one...
5
by: SA Dev | last post by:
Hi, I just finished writing something to make a help file for a Pocket PC device. The Pocket PC device allows not really showing the .HTM file as a long single file, but instead uses a tag to...
5
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
10
by: Tim Mulholland | last post by:
My company is about to begin working on an ASP.NET application. There are going to be two primary developers working on this project. It will be a fairly deep project (lots of lines of code) but...
7
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user...
0
by: genc ymeri | last post by:
Hi over there, Does the .Net20 framework provide library classes/drivers to convert multiple single tiff files into a single multi-pages file or should I use third party tools ? Genc.
3
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source...
6
by: Orgun | last post by:
Hi, I sent this message to the moderated c++ group too but it is waiting for moderator approval and I wanted to send here too. I am new to Design Patterns. I want to write a simple...
10
by: Sebarry | last post by:
Hi, I'm using the code at http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/ to upload multiple files with a single file element. It works fine...
3
by: Tim | last post by:
Hi Folks, I'm used to a UNLOAD command that allows me to dump to a named flat file the results of any SELECT statement. Hence one can build a single SQL file which contains multiple SQL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.