tags:

views:

90

answers:

3

no border shows up when setting style in the table row below, inside the while loop? why? Background color setting works fine, but not this... NO BORDER SHOWS UP...

    // Build Result String
$display_table = "<table>";
while($row = mysql_fetch_array($qry_result)){

$display_table .= "<tr style='border-top-width: thin; border-top-style: solid;'>"; //  wont work here, why????? But if I set bgr color to something, the bgr color works, but not the border thing... hmmmmmm

$display_table .= "<td width='110' rowspan='2'>BILD HÄR</td>";
$display_table .= "<td width='377' height='15'>$row[headline]</td>";
$display_table .= "<td width='67' rowspan='2'>$row[insert_date]</td>";
$display_table .= "</tr>";
$display_table .= "<tr>";
$display_table .= "<td height='15'>$row[price]:-</td>";
$display_table .= "</tr>";
}

$display_table .= "</table>";
echo $display_table;
+3  A: 

Rows don't have borders. Cells do. Move border-top-style: solid to the td elements within the tr.

Jeremy Stein
<table> does have border too. Just do complement your comment.
Ismael
CSS. Confusing the hell out of everyone since 1996.
PeterAllenWebb
+3  A: 

css doesnt always work on the tr element because it's just a container tag, try putting a class on the tr and using the stylesheet to style it up

e.g.:

<style type="text/css">
    .myrow td
    {
        border-top:solid 1px black;
    }

</style>

<table>
    <tr class="myrow">
        <td>...
John Boker
+1  A: 

You can try using these styles

table {
  border-collapse:collapse;
}

td {
  border-top: 1px solid black;
}
Virat Kadaru