Really this is less of a Perl question and more of an HTML question, but I'll bite.

My favorite way to render HTML pages is using HTML::Template which allows me to create a set of template files with "placeholders" that I use later to populate real data into the rendered page. I won't go into a whole tutorial on that here, but that's one thing to look at.

My second favorite is to use the CGI module. Example:

#!/usr/bin/perl -w use strict; use CGI qw/:all/; print start_html,p("Hello world"),end_html;
which produces:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <p>Hello world</p> </body> </html>
If your trying to output to a file instead of STDOUT you'd do something like this:
#!/usr/bin/perl -w use strict; use CGI qw/:all/; open FOUT,"> my_html_page.html" or die $!; print FOUT start_html,p("Hello world"),end_html;

As far as each letter having a different color goes I'm not sure what you are after but if I want to change the color of some text it's going to look something like:

#!/usr/bin/perl -w use strict; use CGI qw/:all/; print start_html,p({ style => "color: red;"},"Hello world"),end_html;
and if you're using a CSS sheet and have a class or id set up for what you want you can invoke it with {id => "foo"} just as I did with the style invocation above.

As far as keeping your columns even and forcing a wraparound within a cell goes, that is strictly and HTML issue. Here (from a Perl perspective) what that looks like:

print table({width=>'80%',tr(td({width=>'30%',"thing1"), td({width=>'60%',"thing2"), td({width=>'10%',"a really long thing") ));
The very right most column being the smallest and depending on the screen size should wrap nicely.

There are other subtleties to explore in a combination of Perl-fu and HTML-fu and are beyond the scope of this thread.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: PERL HTML HELP by blue_cowdawg
in thread PERL HTML HELP by Singh121

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.