user188962
user188962

Reputation:

something i missed here, style in PHP table row works partly!

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;

Upvotes: 1

Views: 354

Answers (3)

Virat Kadaru
Virat Kadaru

Reputation: 2256

You can try using these styles

table {
  border-collapse:collapse;
}

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

Upvotes: 1

John Boker
John Boker

Reputation: 83709

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>...

Upvotes: 3

Jeremy Stein
Jeremy Stein

Reputation: 19661

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

Upvotes: 3

Related Questions