PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.CSS > your thoughts on applying multiple stylesheets to a page
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
your thoughts on applying multiple stylesheets to a page

Réponse
 
LinkBack Outils de la discussion
Vieux 28/02/2008, 22h52   #1
William Gill
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut your thoughts on applying multiple stylesheets to a page

I have a main stylesheet that I apply to all pages in a site, they each
sub-section has a subsection stylesheet that either overrides or applies
new style to pages in that subsection, then finally each page in a
subsection may need even more fine tuning.

In the past I would use <link href="page.css" rel="stylesheet"
type="text/css">, then in page.css I would import section.css, and
section.css would import main.css.

I am looking at changing to multiple link tags like:
<link href="main.css" rel="stylesheet" type="text/css">
<link href="section.css" rel="stylesheet" type="text/css">
<link href="page.css" rel="stylesheet" type="text/css">

Assuming I am careful to consider the cascade, is there anything I
should be careful of using this method to apply multiple stylesheets?
Also, what are the implications of using or not using a common title
attribute?


  Réponse avec citation
Vieux 28/02/2008, 23h34   #2
Ian Hobson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

William Gill wrote:
> I have a main stylesheet that I apply to all pages in a site, they each
> sub-section has a subsection stylesheet that either overrides or applies
> new style to pages in that subsection, then finally each page in a
> subsection may need even more fine tuning.
>
> In the past I would use <link href="page.css" rel="stylesheet"
> type="text/css">, then in page.css I would import section.css, and
> section.css would import main.css.
>
> I am looking at changing to multiple link tags like:
> <link href="main.css" rel="stylesheet" type="text/css">
> <link href="section.css" rel="stylesheet" type="text/css">
> <link href="page.css" rel="stylesheet" type="text/css">
>
> Assuming I am careful to consider the cascade, is there anything I
> should be careful of using this method to apply multiple stylesheets?


The issue with multiple stylesheets, is that each one has to be fetched.
three links will give the browser the opportunity to fetch them in
parallel, will some, but the overhead is still heavy.

Include the page stuff in the page or into the session file.

Then probably use one link to the section css file which would contain
the main.css stuff repeated for each.

If the main is large and the section one tiny I might use two links, but
I prefer to use one. That way I can see it all the CSS in one place.

The overhead of sending css to the browser that is not used in a page,
is tiny, if the css is reused in later pages.

> Also, what are the implications of using or not using a common title
> attribute?
>

What? The title attribute provides text that appears as a tool tip to
the user, for various durations, in some browsers, and not at all in
other browsers. Not a CSS issue.

Regards

Ian

  Réponse avec citation
Vieux 29/02/2008, 00h01   #3
Bergamot
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

Ian Hobson wrote:
>
> The overhead of sending css to the browser that is not used in a page,
> is tiny, if the css is reused in later pages.


Agreed. Caching is A Good Thing.

--
Berg
  Réponse avec citation
Vieux 29/02/2008, 00h07   #4
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

..oO(William Gill)

>I have a main stylesheet that I apply to all pages in a site, they each
>sub-section has a subsection stylesheet that either overrides or applies
>new style to pages in that subsection, then finally each page in a
>subsection may need even more fine tuning.
>
>In the past I would use <link href="page.css" rel="stylesheet"
>type="text/css">, then in page.css I would import section.css, and
>section.css would import main.css.
>
>I am looking at changing to multiple link tags like:
><link href="main.css" rel="stylesheet" type="text/css">
><link href="section.css" rel="stylesheet" type="text/css">
><link href="page.css" rel="stylesheet" type="text/css">
>
>Assuming I am careful to consider the cascade, is there anything I
>should be careful of using this method to apply multiple stylesheets?


Not really. I use both ways in my projects.

For example there is a main stylesheet shared between various projects
and some additional project-specific stylesheets, all applied with
'link' elements like above. The shared main CSS also uses a number of
@import rules to include some other files, which are kept separately
simply for the ease of maintenance.

The only little drawback is the number of HTTP requests required in
order to download all these files. Every 'link' and every @import counts
and might slow down the page rendering on the first request. After that
all CSS should be in the browser cache.

>Also, what are the implications of using or not using a common title
>attribute?


If you're referring to the 'title' attribute for CSS links - they can be
used to offer alternative stylesheets which the user may choose from.

Micha
  Réponse avec citation
Vieux 29/02/2008, 02h10   #5
William Gill
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

Ian Hobson wrote:
> The issue with multiple stylesheets, is that each one has to be fetched.
> three links will give the browser the opportunity to fetch them in
> parallel, will some, but the overhead is still heavy.


Since each common stylesheet like main.css or section.css will only need
to be fetched on the first page that needs it, and cached for any
subsequent pages, I think the overhead issue should be under control.

> What? The title attribute provides text that appears as a tool tip to
> the user, for various durations, in some browsers, and not at all in
> other browsers. Not a CSS issue.


Actually use of the title attribute designates a stylesheet as
preferred. Setting the rel attribute to "alternate stylesheet" and
using the title attribute designates a stylesheet as alternate. I did
read something about setting title to the same value in several link
elements combines the sheets into one, which might impact the cascade,
but it's not obvious to me how or if it really does. It's an HTML
issue, but it impacts the css.

  Réponse avec citation
Vieux 29/02/2008, 02h15   #6
William Gill
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

dorayme wrote:

> No.


Succinct, and very low overhead! <G>
  Réponse avec citation
Vieux 29/02/2008, 03h55   #7
Bergamot
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

William Gill wrote:
> Ian Hobson wrote:
>
>> What? The title attribute provides text that appears as a tool tip

>
> Actually use of the title attribute designates a stylesheet as
> preferred.


You didn't make it clear you were referring to the stylesheet title. I
also read your original question as a more general inquiry about the
title attribute.

> I did
> read something about setting title to the same value in several link
> elements combines the sheets into one,


Yes, that's true.

> which might impact the cascade,
> but it's not obvious to me how or if it really does.


It does. All stylesheets with the same title are considered one, so
cascading does happen. IE doesn't support alternate stylesheets, of
course, but other browsers do.

--
Berg
  Réponse avec citation
Vieux 29/02/2008, 14h33   #8
Andreas Prilop
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: your thoughts on applying multiple stylesheets to a page

On Thu, 28 Feb 2008, William Gill wrote:

> I did read something about setting title to the same value
> in several link elements combines the sheets into one,
> which might impact the cascade, but it's not obvious to me
> how or if it really does.


See http://www.unics.uni-hannover.de/nht...nnotation.html
for an example.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h08.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13381 seconds with 16 queries