Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
Short question this... can I put a background color into my textarea grenerated by cgi.pm.
new CGI->textarea(-name=>'name',-default=>'default', -rows=>3, -column +s=>50),
I can do it in a plain html form like:
<FORM METHOD=post ACTION="/cgi-bin/example.cgi"> <TEXTAREA wrap="virtual" name="comments" rows=6 cols=20 STYLE="backgro +und:#EAE8E8">
Just don't know how to put it into my scripts, any pointers would be much appreciated.

Jonathan.

Replies are listed 'Best First'.
Re: Background color for a cgi textarea
by Fletch (Bishop) on Mar 26, 2004 at 14:35 UTC

    Erm, why not try the obvious?

    $ perl -MCGI -le 'print CGI::textarea( -name => "foo", -style => "back +ground: #eae8e8" );' <textarea name="foo" style="background: #eae8e8"></textarea>
      It is always a good idea to separate style from content using css, so I'd prefer this:
      #!/usr/bin/perl use strict; use warnings; use CGI; my $q = new CGI; print $q->start_html( -title=>'Your page', -style=>{'src'=>'/css/default.css'}, ); # # yada yada yada # print $q->textarea( -name => "bar", -class => "inked" ); print "\n";
      of course you need a separate css-file:
      .inked { background: #E0E0F0; border-width: 1px; border-style: solid; }
        And it's even better to seperate the html completely out of your code, via the use of templates of some sort.