我有以下CSS代码:

#Layer3

{
position:absolute;
width: 89%;
height: 40%;
left: 10%;
top: 56%;
background-color: #f1ffff;
}

#Layer3 h1
{
font-size: medium;
color: #000033;
text-decoration: none;
text-align: center;
}

.tableheader {
    border-width:10px; border-style:solid;
}
.tablecontent {
    height: 95%;
    overflow:auto;
}


但是,当我使用此PHP生成html时

echo '<div id="tableheader" class="tableheader">';

echo "<h1>{$query} Auctions</h1>" . "\n";
echo "</div>";
echo '<div id="tablecontent" class="tablecontent">';

echo "<table border='0' width='100%'><tr>" . "\n";

echo "<td width='15%'>Seller ID</td>" . "\n";

echo "<td width='10%'>Start Date</td>" . "\n";

echo "<td width='75%'>Description</td>" . "\n";

echo "</tr>\n";

// printing table rows

    foreach ($rows as $row)

    {

        $pk = $row['ARTICLE_NO'];

        echo '<tr>' . "\n";

table contens generated in here

        echo '</tr>' . "\n";

    }
echo "</table>";
}

echo "</div>";


生成此html:

<div id="tableheader" class="tableheader">
<h1>hardy Auctions</h1>
</div>
<div id="tablecontent" class="tablecontent">
<table border='0' width='100%'>
<tr>
<td width='15%'>Seller ID</td>
<td width='10%'>Start Date</td>
<td width='75%'>Description</td>
the rest of table stuff
</div>


正确引用了样式表,所以我不确定是什么导致了错误。但是,在表头周围根本没有边界。这两个图层都位于第3层中,该图层不再正确显示在页面上。

最佳答案

#tableheader {
  border: 10px solid #000;
}


尝试给它上色。

编辑:由于其ID是tableheader,请尝试将样式选择器更改为ID。您也可以尝试使用!important查看是否有任何东西覆盖了您的类选择器。

特异性值:

内联:1000; id:100,类:10,元素:1

!important胜过所有其他不重要的声明。

08-03 20:35
查看更多