Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

change font size in table rows using cgi

by sara2005 (Scribe)
on Sep 18, 2005 at 20:11 UTC ( [id://493052] : perlquestion . print w/replies, xml ) Need Help??

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

I need to change the font size (make it bigger than the default) in a table that i generate using CGI.

when i did a search, i found that if i add -class=>'size...', i can change the font but it doesn't seem to work..

Below is the code.. Can someone tell me what the correct format is? I am not able to get the format and option for table in cgi.pm module in cpan.org. Can someone point me to the tutorial location? Thanks Sara

Tr({-align=>CENTER,-valign=>TOP }, [ th({-bgcolor=>'#f9f3c6', -class=>'sizetwo'},['text', 'te +xt','text','text']), td({-class=>'sizetwo'}, },['text', 'text','text','text'] +), td({-class=>'sizetwo'}, },['text', 'text','text','text'] +), ]

Replies are listed 'Best First'.
Re: change font size in table rows using cgi
by CountZero (Bishop) on Sep 18, 2005 at 20:51 UTC
    Just from the top of my head: if you are using the class keyword, doesn't it refer to some CSS you must define?

    Have a look at the CGI docs about CSS

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: change font size in table rows using cgi
by Samy_rio (Vicar) on Sep 19, 2005 at 01:09 UTC

    Hi, Good Morning. Here is my suggestion.

    print table({-border=>2, -style=>'Font-Size: 25pt;'}, Tr({-align=>CENTER,-valign=>TOP}, [ th({-bgcolor=>'#f9f3c6', -style=>'Font-Size: 35pt;'},['t +ext', 'text','text','text']), td(['text', 'text','text','text']), td(['text', 'text','text','text']), ]) );

    Give "-style" in the required row or field. I think it will help you.

    Regards,
    Velusamy R.

      Its generally better to avoid inline style (the style attribute) in favour of an external style sheet. This makes things much easier to maintain in the long run.

      Its also a very bad idea to use the pt unit since:

      • Most browsers don't know the DPI of the screen, so can't render pts correctly
      • Internet Explorer makes it very difficult for the user to override point units, which is a pain if you can't read text as small as the author chooses
      • It pays no attention to the user's preferences for font size

      Generally speaking, percentages are the best unit for font sizing.

Re: change font size in table rows using cgi
by monarch (Priest) on Sep 18, 2005 at 23:00 UTC
    Your question is an HTML one, and I strongly recommend you visit:
      http://www.htmlhelp.org/

    In short you can change font sizes through <span>, <font>, and styles which are accessed through the <class> option.

    The answer is not in CGI.pm; learn more about HTML and how CGI.pm produces HTML. Therein lies your answer.