Benvenuti da Idea R | Vicenza - Romano di Lombardia (Bergamo)
Passa alla visualizzazione per i dispositivi mobili

      Idea R - Pianifica la tua comunicazione visiva a 360°

Blog

Prendere uno smanettone del software degli anni 80, aggiungere un graphic designer di nuova generazione e allungare il tutto con uno studioso di strategie di marketing. Agitare energicamente e si ottiene il blog Idea R.

Change language... English

Style sheets caching problems

Pubblicato il 10/23/2011
Categorie: Siti Web
Style sheets caching problems

Questo articolo è disponibile anche in italiano.

Microsoft IIS caches all the style sheets that are placed inside the App_Themes folder, remembering the ones that are used by the web site pages (by all pages, not only the current one); the effect is easily visible looking at the HTML code sent to the client, noting that are included CSS links that were not specified for the page.
This behavior requires a strong attention on styles inheritance, but also can make Internet Explorer versions prior to the 9 to overflow the maximum number of style tags allowed: in these versions the maximum number of style tags is 32 and all the following ones are ignored.
My personal advise is to use the App_Themes folder only and exclusively for themes and to use another one, for example Styles, for style sheets.

As anticipated, if the App_Themes folder is needed, you have to pay attention to styles inheritance, always resetting properties, for example:

/* This is in a not included (but cached) style sheet */
.myStyle
{
    top: 10px;
}

/* This is in a included style sheet */
.myStyle
{
    bottom: 100px;
}

The result will be:

/* This is in a included style sheet */
.myStyle
{
    top: 10px;
    bottom: 100px;
}

To avoid top inheritance from the cache, the included style sheet has to be:

/* This is in a included style sheet */
.myStyle
{
    top: auto;
    bottom: 100px;
}

Sei il lettore numero 13,712.

Commenti

Articolo precedente

Articolo precedente

Cenni sulla Brand Identity

Articolo successivo

Dipingere con la luce

Articolo successivo

Torna all'inizio