我有一张简单的桌子。我想在每个每个单元格周围使用$subjet = "/home/rasmus/../fichero.txt"; //One folder up of your scipt path example
$subjet = "/home/rasmus/../../fichero.txt"; //Two folders up of your script path example
边框。由于某种原因,我只能得到概述整个表格的边框。我尝试将1px solid black
添加到表格样式中,我认为这是默认样式,但这也不起作用。
我做错什么了吗?我如何毗邻每个单元格?
我现在所拥有的是这个
border-collapse: separate;
答案 0 :(得分:2)
您需要将边框应用于单元格(TD)而不是表格
TD,TH {
border:1px solid black;
}
<!doctype html>
<html>
<body style="font-family:Arial;">
<table style="font-family:Arial; font-size:12px;">
<tr>
<th align="left">Initiative</th>
<th align="left">Scheduled Finish</th>
</tr>
<tr>
<td align="left">[Initiative Name]</td>
<td align="left">[Initiative Scheduled Finish Date]</td>
</tr>
</table>
</body>
</html>
答案 1 :(得分:1)
在您的CSS中尝试:
th, td { border: 1px solid black; }
答案 2 :(得分:1)
最安全的方法是给您的表一个类。这样,它就不会影响页面中的任何其他表。
.my-table-border th,
.my-table-border td {
border: 1px solid black
}
<!doctype html>
<html>
<body style="font-family:Arial;">
<table class="my-table-border" style="font-family:Arial; font-size:12px; border:1px solid black;">
<tr style="outline: thin solid">
<th align="left">Initiative</th>
<th align="left">Scheduled Finish</th>
</tr>
<tr style="outline: thin solid">
<td align="left">[Initiative Name]</td>
<td align="left">[Initiative Scheduled Finish Date]</td>
</tr>
</table>
</body>
</html>
表类为my-table-border
,选择器仅在具有此类的表内选择td
和th
。