2013-06-18 36 views
1

我有我的观点Projet有此表的asp.net应用MVC4:表内添加行HTML

<table style="line-height:30px; "> 
    <tr> 
     <th style="width:20%;color:blue"> 
      Description de projet 
     </th> 
     <th style="width:20%;color:blue"> 
      Le client 
     </th> 
     <th style="width:20%;color:blue"> 
      Le statut du client 
     </th> 
     <th style="width:20%;color:blue"> 
      Le groupe responsable 
     </th> 

    </tr> 

@for (int i = 0; i < Model.Count; i += 4) { 
    <tr> 
     <td style="width:20%"> 
      <center>@Model[i]</center> 
     </td> 
     <td style="width:20%"> 
      <center>@Model[i+1]</center> 
     </td> 
     <td style="width:20%"> 
      <center>@Model[i+2]</center> 
     </td> 
     <td style="width:20%"> 
      <center>@Model[i+3]</center> 
     </td> 

    </tr> 
} 

</table> 

我的问题是:即使我用不显示表内的行标签<th>

为什么发生这种情况?我该如何解决它?

+3

什么行?你是指边界? ['line-height'](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height)可能不是你想象的那样。另外['

'](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center)已弃用,只需将'text-align:center;'应用到'td'/'CSS'。 –

+0

是的,我的意思是边界,为'行高'我用它来定义行之间的空间 – Lamloumi2

+0

检查你的CSS,你可能已经隐藏了表格行(边框)。正如大卫所说,线条高度不适合线条。 – Brij

回答

1

为了显示边框,您可以使用: -

<table style="border: 1px solid black;"> 
+0

水平线可以,但垂直线可以添加什么? – Lamloumi2

1

你也可以写像

<table border="1"> 

显示边框和线条,水平和垂直。