0
我正在尋找樣式我的表格列例如使作者列顯示例如「書名」以粗體顯示紅色,而斜體藍色等的價格...通過php使用CSV數據的表格中的樣式列使用php
2012-03-11,paul,the book title,386,10,256
我的PHP代碼
echo "<table cellspacing='0' cellpadding='0'> \n\n
<thead>
<tr>
<th>Date</th>
<th>Author</th>
<th>Title</th>
<th>Prices</th>
<th>Sales</th>
<th>Rank</th>
</tr>
</thead>";
$f = fopen("local/bookdata.csv", "r");
$i = 0;
while (($line = fgetcsv($f)) !== false) {
echo "<tr class='$class".(($i%2)?'odd':'even')."'>";
foreach ($line as $cell) {
echo "<td style='font-weight: bold;'>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
$i++;
}
fclose($f);
echo "\n</table>";
任何最受歡迎的幫助
不要忘了良好的醇行! tr:nth-child(偶數){background:#CCC} tr:nth-child(奇數){background:#FFF} – Bradmage 2012-03-11 08:43:40