2013-06-18 33 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"> 

顯示邊框和線條,水平和垂直。