2013-05-07 52 views
0

我在我的視圖中呈現了四張表格。其中三個表是部分視圖。該視圖是這樣的:剃刀視圖和asp.net mvc中的樣式表3

@using (Html.BeginForm()) 
{ 
    <div id="drawForm"> 
    @Html.Partial("_PartialHeader") 
    @Html.Partial("_PartialDrawing") 
    <table border="1"> 
    @for (int i = 0; i < 4; i++) 
     { 
      <tr> 
       <td>@(i+1)</td> 
       @Html.Partial("_PartialDropDown") 
      </tr> 
     } 
    </table> 
    @Html.Partial("_PartialFooter") 
    </div> 
    <button type="submit">Save</button> 
} 

這是_PartialHeader視圖:

<table border="1"> 
    <tr> 
     <td> 
      Logo drawing here 
     </td> 
    </tr> 
</table> 

這是_PartialDrawing

<table border="1"> 
    <tr> 
     <td> 
      <img src="@Url.Content("~/Content/MachineDrawing.png")" alt="Logo" /> 
     </td> 
    </tr> 
</table> 

_PartialFooter

<table border="1" > 
    <tr> 
     <td> 
      First sign 
     </td> 
     <td> 
      Sexond sign 
     </td> 
    </tr> 
</table> 

只有_PartialDropDown不是一個表本身。它看起來像這樣:

<td> 
    Type 1 
</td> 
<td> 
    <select name="YesNoNotApplicable"> 
     <option>Yes</option> 
     <option>No</option> 
     <option>Not Applicable</option> 
    </select> 
</td> 
<td> 
    Edit field if No is chosen 
</td> 

所以基本上是在mozila會發生什麼,當我向上和向下滾動我得到這個Scroll Up

TableUp

而且這裏的時候,我Scroll down

enter image description here

其他出現的邊界消失。我在IE8中測試過,我沒有遇到這個問題。我使用的CSS的是這樣的:

table { 
    border-collapse: collapse; 
    width: 686px; 
    margin: 0px 1px 20px 1px; 
} 
td { 
    height: 55px; 
} 

和所有的表都呈現它有這個CSS附加div標籤裏:那麼,爲什麼和

#drawForm 
{ 
    margin: 0 auto; 
    width: 690px; 
    height: 800px; 
    padding-top: 2px; 

} 

我怎樣才能解決這個問題?

+0

您可以嘗試刪除邊框塌陷,邊距和填充...僅用於嘗試 – 2013-05-07 09:35:35

+0

嘗試添加
以便表格的邊框不會摺疊? – 2013-05-07 16:45:54

回答

0

所以我找到了兩種方法應該根據案件工作。我認爲更優雅的方式是我在某個論壇上閱讀的解決方案。這是說,加入<thead>to the tables fix this issue. Other people were confirming that this solution works, however in my case it did not so instead I styled my table with border-spacing:0px;`。這是一種解決方法,但如果沒有其他工作,結果是可以接受的。

+0

在''之前缺少一個「\」。 – BCdotWEB 2018-02-15 14:52:54