如果我设置了参数border-collapse: collapse
,那么边框是可见的。是什么规范了这种行为?
table {
width: 100%;
border-collapse: collapse;
}
thead {
border-top: solid 1px;
}
<table>
<thead>
<tr>
<th> </th><th>2013</th>
<th>2014</th><th>2015</th>
</tr>
</thead>
<tbody>
<tr>
<td>Нефть</td><td>43</td>
<td>51</td><td>79</td>
</tr>
<tr>
<td>Золото</td><td>29</td>
<td>34</td><td>48</td>
</tr>
<tr>
<td>Дерево</td><td>38</td>
<td>57</td><td>36</td>
</tr>
</tbody>
</table>
否则:
table { width: 100%; border-collapse: separate; }
thead { border-top: solid 1px; }
<table>
<thead>
<tr>
<th> </th><th>2013</th>
<th>2014</th><th>2015</th>
</tr>
</thead>
<tbody>
<tr>
<td>Нефть</td><td>43</td>
<td>51</td><td>79</td>
</tr>
<tr>
<td>Золото</td><td>29</td>
<td>34</td><td>48</td>
</tr>
<tr>
<td>Дерево</td><td>38</td>
<td>57</td><td>36</td>
</tr>
</tbody>
</table>