我正在尝试加粗表格最后一列的内容,不知道如何选择这些键值并使用jquery应用粗体,非常新的。
<?php
$items = array(
array("City" => "Dalas","Age" => "47", "Name" => "Janet Fuller", "Address" => "445 Upland Pl.", "Status" => "Trial"),
array("City" => "Lyon", "Age" => "38", "Name" => "Andrew Heiniger", "Address" => "347 College Av.", "Status" => "Active"),
array("City" => "Dallas", "Age" => "43", "Name" => "Susanne Smith", "Address" => "2 Upland Pl.", "Status" => "Active"),
array("City" => "Paris", "Age" => "25", "Name" => "Sylvia Steel", "Address" => "269 College Av.", "Status" => "Suspended"),
array("City" => "San Francisco", "Age" => "7", "Name" => "James Peterson", "Address" => "231 Upland Pl.", "Status" => "Active"),
array("City" => "Oslo", "Age" => "42", "Name" => "Robert Ott", "Address" => "503 Seventh Av.", "Status" => "Trial")
);
?>
<?php if (count($items) > 0): ?>
<table>
<thead>
<tr>
<th><?php echo implode('</th><th>', array_keys(current($items))); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $row): array_map('htmlentities', $row); ?>
<tr>
<td><?php echo implode('</td><td>', $row); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
答案 0 :(得分:1)
只需使用css:
#myTable td:last-child {
font-weight: bold;
}
&#13;
<table id="myTable">
<thead>
<tr>
<th>first</th>
<th>last</th>
</tr>
</thead>
<tbody>
<tr>
<td>first</td>
<td>last</td>
</tr>
<tr>
<td>first</td>
<td>last</td>
</tr>
</tbody>
</table>
&#13;