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

Hi Monks,

I use CGI.pm to create submit buttons but I am wondering if there is a way to set a standard size for the buttons, irrespective of the text.

For example, the below code works fine and creates the buttons, but of different sizes.

... .. print $query->table( {-border=>0, -cellpadding=>2, -cellspacing=>0 }, $query->Tr( [ $query->td( [ $query->submit( -name=>'name1', -value=>'Help'), "   ". $query->submit( -name=>'name2', -value=>'Perform Action +', -onclick=>"submitform('action')" ), "   ". $query->submit( -name=>'name3', -value=>'Outputs', -onc +lick=>"submitform('output')" ) ]), ]) ); ... ... ...

I can overcome the problem by 'manually', introducing spaces 'in front' and 'after' the text like

... .. $query->submit( ...., -value=>' Help ', .... ) ... $query->submit( ....., -value=>' Outputs ', .... ...

but the issue is, these buttons have to be generated dynamically based on what I read in the previous script. So, it can be a minimum of 2 to maximum of 'N' buttons and hence, it would be nice to define a standard size for the button.

Is there a way to achieve this? Please help.

Replies are listed 'Best First'.
Re: CGI: How to set a standard size for a SUBMIT button
by Joost (Canon) on Nov 23, 2006 at 14:55 UTC

      Thanks a lot.

      I am using CSS for displaying the pages but it turned out that I was not using the correct property for the 'input' selector to change the size of the button.

      It works fine now after I changed the property from 'size' to 'width'