I have a PHP script that I am using to create a table. The CSS is as follows:
<style type='text/css'>
.boardsquare { border-color: black; border-width: 1; border-style: solid; width:50px; height:50px; font-size: 2em; text-align: center; background-color:pink; }
body {margin-right: 10%; margin-left: 10%; }
</style>
The following PHP script is used to call it:
if(isset($attempt1)) // print out letters of first attempt
{ $letter_place = 0;
foreach($attempt1 as $try_letter)
{
$background_color = in_word ($try_letter, $answer_letters);
if ($try_letter == $answer_letters[$letter_place]) $background_color='green';
echo "<td class='boardsquare'>";
echo $try_letter;
echo "</td>";
$letter_place = $letter_place + 1;
}
}
else //if no first attempt yet, insert textboxes
{
echo "<td class='boardsquare'> <input type='text' id='1a' name='1a' maxlength='1' value='Z'> </td>";
echo "<td class='boardsquare'> <input type='text' id='1b' name='1b' maxlength='1'> </td>";
echo "<td class='boardsquare'> <input type='text' id='1c' name='1c' maxlength='1'> </td>";
echo "<td class='boardsquare'> <input type='text' id='1d' name='1d' maxlength='1'> </td>";
echo "<td class='boardsquare'> <input type='text' id='1e' name='1e' maxlength='1'> </td>";
echo "<tr>";
$last_row = 'yes';
}
The problem is that the width and height setting are not applying when I run the program. It is reading the CSS, because the rest of the CSS code works (the cells are pink, for instance). But the cells are not 50px by 50 px like I want. The second half of the script (the else clause) is what is calling it (the Z appears in the first cell).
If I copy the CSS code and put it in a simple html document and create a small table, the cells size just fine, but not when it is called from the PHP program. Does anyone have any idea why the settings don’t take? (I have tried it in three different browsers – all the same.)