开发者

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

开发者 https://www.devze.com 2022-12-08 20:04 出处:网络
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...

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;


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


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


You can try using these styles

table {
  border-collapse:collapse;
}

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

精彩评论

暂无评论...
验证码 换一张
取 消