Is there a way in a PM node/posting to use a <style ...> block?

–hsm

"Never try to teach a pig to sing…it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: A meta Style question
by particle (Vicar) on Feb 16, 2002 at 15:20 UTC
    the <style>...</style> tag is valid only in an html header. therefore, it appears per page, not per node/posting.

    you can apply cascading style sheets through use of the style tag on your homenode, hsmyers. there are two methods of applying styles to your pages here: linking to an external stylesheet, or storing style info onsite. this is a new feature, introduced on Petrucio's We Stylin'! node.

    there are a few examples there. enjoy!

    Update: i just added PerlMonks CSS Examples. hopefully, others will add their stylesheets here. you can cut and paste any of these examples in the spot provided on your homenode.

    ~Particle

      A cool thing certainly, but unless I'm wrong (always possible), that allows me to change how a page looks to me, while what I'm looking for would allow a change to how the page looks for everyone. I will also admit, up front, that I've no earthly clue as to how you get around the only valid in the header problem, that's why I was hoping someone else had figured it out...

      –hsm

      "Never try to teach a pig to sing…it wastes your time and it annoys the pig."
        it is possible to use styles inline, that is, in the body of your html doc. you'd have to specify something like:

        <div style="color:red;">i see some red text <span style="color:red;background:black">and i want to paint it black< +/span> </div>
        which should show up as red text on your default background, followed by red text on a black background. here it is:

        i see some red text and i want to paint it black

        as you can see, it didn't work.

        in fact, if you view the page source, you should see something like:

        here it is:<P> i see some red text and i want to paint it black <P>
        perlmonks has a scrubber that removes illegal (as deemed by those most holy) attributes from html tags in the nodes you post.

        currently, the style attribute is not allowed. nor are div or span tags. so you can't use CSS inline at perlmonks. but all is not lost. you can use html attributes, like <font>, etc. here's an example, one of saint grinder's sigs...

        <SMALL>--</SMALL><H5><TT><FONT color="#cf1178">g</FONT> <FONT color="# +bd2188">r</FONT> <FONT color="#a73598">i</FONT> <FONT color="#904da7" +>n</FONT> <FONT color="#7866b5">d</FONT> <FONT color="#6080c2">e</FON +T> <FONT color="#4999ce">r</FONT></TT></H5>
        produces: --
        g r i n d e r

        this might be a solution for you. but you can't guarantee users will see what you want them to. CSS can override any tag, including <font>. my stylesheet overrides the font tag, so i see dark blue text on a light blue background.

        there are a few things, like font tags, that you can modify. feel free to experiment. if you see something you like, view the page source, and practice code reuse.

        Update: i *totally* forgot to link to the approved html tags! thanks for the catch, tye!

        ~Particle