Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > <td>s all the same height?

<td>s all the same height?
Thread Tools
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
May 26, 2003, 02:05 AM
 
Hi,
I was wondering how to make a table behave as follows: Have all td's in a row be the same height. I vaguely remember it doing that by default (i.e, if the third td you added was tall, the rest would be just as tall) but it's not doing it for me.

EDIT:
It does do it, unless each td has a div box in it (which is what I have). If I take out the div boxes then each td is the same height, but it just looks so ugly. So, I guess my question is how to do this if I put a differently heighted div box in each box.

Help!
thanks,
gabe
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
May 26, 2003, 09:47 AM
 
Originally posted by Zimwy:
Hi,
I was wondering how to make a table behave as follows: Have all td's in a row be the same height. I vaguely remember it doing that by default (i.e, if the third td you added was tall, the rest would be just as tall) but it's not doing it for me.

EDIT:
It does do it, unless each td has a div box in it (which is what I have). If I take out the div boxes then each td is the same height, but it just looks so ugly. So, I guess my question is how to do this if I put a differently heighted div box in each box.

Help!
thanks,
gabe
Could you post an example?
     
Zimwy  (op)
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
May 26, 2003, 04:33 PM
 
Synotic, first off, thank you so much for answering like every single post I put up here. It's very much appreciated.

Here's my code exactly: I've put a border of 2 pixels on the table so that you can see the strange sizing and such.
[PHP]
<html>
<body>
<table cellpadding = 2 border = 2 >
<tr>
<td></td>
<td></td>
<td colspan=3>
<div class = "red">
<center><h1>
<?php
echo date("F");
?>
</h1></center>
</div>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td align=center width=175 ><B>Monday</B></td>
<td align=center width=175 ><B>Tuesday</B></td>
<td align=center width=175 ><B>Wednesday</B></td>
<td align=center width=175 ><B>Thursday</B></td>
<td align=center width=175 ><B>Friday</B></td>
<td align=center width=175 ><B>Saturday</B></td>
<td align=center width=175 ><B>Sunday</B></td>
</tr>
<?php
$monthNumber = date("n");
$yearNumber = date("Y");
$firstDayDate = mktime(0,0,0,$monthNumber,1,$yearNumber);
$firstDay = date("D",$firstDayDate);
echo ("First Day of this month is a $firstDay");
$firstDayCol;
$daysInMonth = date('t');

if ($firstDay == "Mon"){
//Firsy Day is a Monday
$firstDayCol = 1;
}
if ($firstDay == "Tue"){
$firstDayCol = 2;
}
if ($firstDay == "Wed"){
$firstDayCol = 3;
}
if ($firstDay == "Thu"){
$firstDayCol = 4;
}
if ($firstDay == "Fri"){
$firstDayCol = 5;
}
if ($firstDay == "Sat"){
$firstDayCol = 6;
}
if ($firstDay == "Sun"){
$firstDayCol = 7;
}
$boxNumCounter = 1;
$dayCounter = 1;
for ($row = 1; $row <= 5; ++$row){
echo("<tr>");
for ($col = 1; $col <= 7; ++$col){
if ( ($boxNumCounter >= $firstDayCol) && ($dayCounter <= $daysInMonth)){
//We've done our blanks
echo ("<td align=center>");
if ( $dayCounter == date('j')){
//It's Today
echo("<div class = 'red' height=100%>");
//echo("<td bgcolor=red>");
echo("hello out there today<br>bye");

}
else{
//echo("<td bgcolor=silver>");
echo("<div class = 'silver' STYLE='height:100%;' >");
}
echo("<a href = 'calendarday.php?day=$dayCounter'>$dayCounter</a><br>");
if ($dayCounter == 20){
echo("I'm going home today");
}
echo("</div>");
++ $boxNumCounter;
++ $dayCounter;
}
else{
//Do a blank
echo("<td></td>");
++ $boxNumCounter;
}
}
echo("</tr>");
}
?>
</table>
</body>
</html>
[/PHP]
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
May 26, 2003, 05:24 PM
 
use something like this: [php]<style type="text/css">
td {
height: 30px;
height: 50px;
text-align: center;
}
</style>[/php]
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Zimwy  (op)
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
May 26, 2003, 05:52 PM
 
Thanks Phil,
That's definitely a start. What if I want the cells to grow taller as more text is added to them?

gabe
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:36 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2