how can i make each teble cell have a fixed size?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

how can i make each teble cell have a fixed size?

Post by Nik »

Code: Select all

while ( $row = $st->fetchrow_hashref )
   {
      print table( {-border=>5, -width=>"80%", -align=>"center", -style=>"Color: LightGreen; font-size: 20", -background=>"../images/blue.jpg"},

         Tr( td( {-align=>'center'}, font( {-size=>4, -color=>'Cyan'},   $row->{onoma}  ) ),
             td( {-align=>'center'}, font( {-size=>4, -color=>'Lime'},   $row->{sxolio} ) ),
	     td( {-align=>'center'}, font( {-size=>4, -color=>'Yellow'}, $row->{xronos} ) ) ),
         
	 Tr( td( {-colspan=>2, -align=>'center'}, font( {-size=>4, -color=>'Pink'},   $row->{host}  ) ),
	     td( {             -align=>'center'}, font( {-size=>4, -color=>'Orange'}, $row->{email} ) ) ) ),

	 br(), br();
   }
i tied to use {width=>'15%'} indise td but didnt work?

anyone have an idea?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

If you want fixed cell-size, use absolute values (not relative, i.e. %) in the height- and width-properties of your cell.

I don't know which class you are using to output that html-table, but try inserting "width='50' height='10'".
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

Post by Nik »

thanks man! it worked ok!
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

Post by Nik »

but why must i use absolute values and not relative??
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

Post by Nik »

actually both ways looks thesame
cells are not fixed!
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

fixed

Post by phpScott »

you must use fixed width and hieght if you always want to have a cell that is 50 pixels by 50 pixels other wise using % 's will have the cells automatically adjust to the that they are are allocated. This could depened on table size or screen size of the person viewing your site.

If what patrikG suggested is not working you might have to remove the width attribure in your table declaration

Code: Select all

<?php
print table( {-border=>5, -width=>"80%", -align=>"center", -style=>"Color: LightGreen; font-size: 20", -background=>"../images/blue.jpg"}, 
?>
as that is allcotion the space for the table size and your td tags will have to use at that much space as you can't have extra table space that is not allocated

phpScott
Post Reply