Geocrafter Geocrafter - 2 months ago 6
CSS Question

Tables and Borders

I am having a little trouble getting tables and borders to work with css. So what I have been doing is taking the and putting on border-width and border-style on it. Now what happens is the OUTside part of the border is the one being affected by the width and style. All the values and rows inside are not being affected by this. The only thing that will work is the color of the border. And the border had to be specify in HTML as border=1 for some reason.

CSS

#usertable {
border-style: dashed;
border-width: 10px;
border-color: red;
padding: 20px;
margin: auto;
margin-top: 20px;
border-collapse: collapse;
}


PHP:

echo "<table id=usertable>
<tr>
<td id=usertable_top>ID</td>
<td id=usertable_top>USERNAME</td>
<td id=usertable_top>PASSWORD</td>
<td id=usertable_top>EMAIL</td>
<td id=usertable_top>ADMIN</td>
<td id=usertable_top>ACTIONS</td>
</tr>";
while($row = $result->fetch_assoc()){
echo "
<tr>
<td>$row[ID]</td>
<td>$row[USERNAME]</td>
<td>$row[PASSWORD]</td>
<td>$row[EMAIL]</td>
<td>$row[ADMINSTATUS]</td>
";
if ($_SESSION[adminsts] == sadmin) {
echo "
<td>Make Admin</td>
";
}
echo "
</tr>
";
}
echo "</table>";

Answer

Setting a border on a table will do exactly that.

If you want to set a border on a table cell, then you have to style the table cell.

td, th { 
    border: solid blue 1px;
}