Also, if you have your CSS in a separate file, you can use the following:
print $q->start_html( -title => "Some Title Here",
-style => { src => '../style.css',
type => 'text/css' } );
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats. | [reply] [d/l] |
Try
print $cgi->p([font(color=>"red", size=>"+2")], "This is my text");
CGI supposedly can handle tags that aren't explicitly
handled. You'll need to double check my CGI statement for
valid syntax, but I think that's how it goes.
ALL HAIL BRAK!!! | [reply] [d/l] |
See, the greatest thing about CGI.pm is the ability to define your own HTML tags using it. Example:
use CGI qw/shortcuts font/;
$q = new CGI;
print $q->font ({size=>'1',color=>'red'}, $q->p("Heyyy"));
But the problem is, why would you want to do this? Why not just print <font size=1 color=red><p>Heyyy</p>? Sorry if I sounded harsh, no hurt intended :-)
Wanna be perl hacker. Dave AKA damian | [reply] [d/l] |
...why would you want to do this? Why not just print <font size=1 ...
Stylesheets are here to stay and they are a Good Thing. Font tags are deprecated. HTML tags and their attributes should only be used to mark the structural elements of your documents and CSS should be used to control the layout of those elements. But don't take my word for it, see what w3c has to say about it.
This is actually related to the problem of why CGI scripts shouldn't have HTML embedded in them (unless it's a simple script). Form and content should be kept distinct. I am constantly working on scripts that have CSS, Javascript, HTML and Perl all tossed together and blended well. Rarely are you working on all of the elements simultaneously. You focus on one at a time and this is tougher to do when their mixed (not to mention what happens when you're asked to change the look and feel of all of the pages).
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] |
Read the perldoc on CGI.pm again and look for
LIMITED SUPPORT FOR CASCADING STYLE SHEETS
I tend to supply font and color info in my script, or
use templates.
Jeff
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
| [reply] |