An additional advantage to this method is that the browser will cache the style sheet locally and reduce the number of calls to your server. Of course, this could be a bad thing if you were planning on changing the style sheet frequently, but in my experience that's pretty rare.

Actually, I'd be interested in hearing about solutions to this as I've tackled this a completely different way in Mason:

/* keys %head */ % foreach (keys %head) { <% $_ %> { font-size: <% $head{$_} %>pt; color: <% $colours{'head'} %> +; \ % if ($isNetscape) { font-family: <% $font_family %>; padding-left: 10px; padding-top: 10px +; \ % } else { margin-left: 10px; margin-top: 10px; \ % } } % } /* keys %text */ % foreach (keys %text) { <% $_ %> { font-size: <% $text{$_} %>pt; \ % if ($isNetscape) { color: <% $colours{'text'} %>; font-family: <% $font_family %>; paddin +g-left: 10px; \ % } % if (($isIE) && ($_ eq 'P')) { line-height: <% $line_height %>pt; margin-left: 10px; \ % } % if ($_ eq 'UL') { list-style-type: circle; \ % } } % } %head = ( 'H1' => $font_size + 6, 'H2' => $font_size + 4, 'H3' => $font_size + 2, 'H4' => $font_size, 'H5' => $font_size ); %colours = ( 'text' => '#FFFFFF', 'head' => '#99CCFF', 'link' => '#CCCCCC', 'vlink' => '#999999', 'alink' => '#99CCFF', 'list' => '#99CCFF', 'smalllist' => '#99CCFF', 'listheaders' => '#99FFFF', 'highlight' => '#FFFFFF', 'data' => '#FF9933' );

I need clean this up a lot, but it was the way that (kind of) made sense to me when I was trying to build a style sheet that would adapt according to browser support/os/individual preferences...


In reply to RE: Re: Parsing and Spewing CSS by jreades
in thread Parsing and Spewing CSS by davemabe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.