我正在尝试向我的 mysql 表添加备用行颜色。我正在使用此代码来回显表结构
//creating our table
echo "<tr>";
echo "<th>ID</h3></th>";
echo "<th>First Name</th>";
echo "<th>Last Name</th>";
echo "<th>email</th>";
echo "<th>street</th>";
echo "<th>Suburb</th>";
echo "<th>State</th>";
echo "<th>Action</th>";
echo "</tr>";
到目前为止我已经尝试过
//creating our table
echo "<tr:nth-child(odd) { background-color: #ccc; }>";
并将其添加到外部样式表
table tr:nth-child(odd) { background-color: #ccc; }>";
但这两种方法都行不通。我怎样才能实现这个目标
最佳答案
th:nth-child(odd) { background-color: #ccc; }
您想要将背景颜色设置为 <th>
浅灰色,不<tr>
关于mysql - 替代 mysql 表行背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27198040/