与rowspan和colspan的表

时间:2018-05-23 18:29:06

标签: html html5 css3 html-table

有人可以解释一下这个colspanrowspan系统是如何工作的,我用rowspan="4"做了这个,但看起来它实际上是3而不是4我的意思是结果,为什么'55577855'和'ikä'在右侧,那么这两个人不应该在'henkilöstöt'之下吗?我已多次尝试过。

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    text-align: left;    
}
</style>
</head>
<body>


<table >
 
<tr>
  <th rowspan="4">Henkilöstöt</th>
  <th colspan="3">koulutus</th>
</tr>
<tr>
 <th rowspan="3">Muu</th>
 <th rowspan="3">Ammattiiiii</th>
 <th rowspan="3">korkeakoulu</th>
</tr>
  
   <tr>
    <th >55577855</th>
  </tr>
   <tr>
    <th>ikä</th>   

  </tr>

</table>
   

  

</body>
</html>

4 个答案:

答案 0 :(得分:1)

很难猜到你真正想要的东西(你应该提供了他想要的输出的图形),但如果你想让最后两个表行在 那么,你必须插入两个空行来弥补第一行中的data = pd.read_csv("something.csv",encoding="utf-8", sep='delimiter', engine='python')

&#13;
&#13;
rowspan
&#13;
&#13;
&#13;

答案 1 :(得分:0)

rowspan和colspan是标签的属性,你如何使用tr和th

你应该尝试使用colspan和rowspan与td

答案 2 :(得分:0)

也许,这会对你有帮助..

    <table border ="1">

<tr>
  <th>Henkilöstöt</th>
  <th>koulutus</th>
</tr>

  <tr>
<td >Muu</th>
 <td >Ammattiiiii</td>
 <td >korkeakoulu</td>
</tr>
   <tr>
    <td>55577855</td>
  </tr>
   <tr>
    <td>ikä</td>   


  </tr>



</table>

答案 3 :(得分:0)

Rowspan使元素向下延伸到下一行。

你有四行:

  • Henkilöstöt,koulutus
  • Muu,Ammattiiiii,korkeakoulu
  • 55577855
  • IKA

当你告诉第二行向下延伸三行时,你并没有告诉它变成三倍大,你告诉它出现在与第三和第四行相同的行上。第三和第四行保留其数据单元并将它们推送到第一个可用位置。

你应该在korkeakoulu行之后粘贴两个空行,或者你应该将所有行扫描的值减少2个。

EDIT     

<tr>
  <th rowspan="2">Henkilöstöt</th>
  <th colspan="3">koulutus</th></tr>
<tr>
 <td>Muu</td>
 <td>Ammattiiiii</td>
 <td>korkeakoulu</td>
</tr>

<tr>
<td >55577855</td>
</tr>
<tr>
<td>ikä</td>   

</tr>

</table>

或者您可以使用:

<table>
<tr>
  <th rowspan="4">Henkilöstöt</th>
  <th colspan="3">koulutus</th>
</tr>
<tr>
 <th rowspan="3">Muu</th>
 <th rowspan="3">Ammattiiiii</th>
 <th rowspan="3">korkeakoulu</th>
</tr>
<tr></tr>
<tr></tr>
   <tr>
    <th >55577855</th>
  </tr>
   <tr>
    <th>ikä</th>   

  </tr>

</table>