我有一個gridview,我試圖在每行之間使用CSS添加空白空間。如何在gridview的行之間添加頁邊距
這不起作用:
#gridview tr{
margin-bottom: 10px;
}
無論是做這個的:
#gridview td{
margin-bottom: 10px;
}
與 「邊界崩潰」 瞎搞什麼都不做也。
任何人都知道如何添加間距?
我有一個gridview,我試圖在每行之間使用CSS添加空白空間。如何在gridview的行之間添加頁邊距
這不起作用:
#gridview tr{
margin-bottom: 10px;
}
無論是做這個的:
#gridview td{
margin-bottom: 10px;
}
與 「邊界崩潰」 瞎搞什麼都不做也。
任何人都知道如何添加間距?
保證金將無法正常工作表元素,你應該使用border
或padding
像下面的代碼片段
table.grid
{
border-collapse: collapse;
}
table.grid tr
{
border: 0px solid white;
border-width: 20px 0;
}
<table class="grid ">
<tr>
<td>
Row 1
</td>
</tr>
<tr>
<td>
Row 2
</td>
</tr>
</table>
你可以使用它在GridView
這樣的:
<asp:GridView ID="PetGrid" runat="server" CssClass="grid">
試試這個
table td {
\t border-bottom: solid 20px transparent;
}
<table>
<tr>
\t <td>Content</td>
</tr>
<tr>
\t <td>Content</td>
</tr>
</table>
使用填充:
#gridview td{
padding-bottom: 10px;
}
哪些GridView控件您使用的?在網格行上嘗試「檢查元素」,並檢查樣式是從哪個.css類繼承而來的。嘗試更改一些參數,如填充/行高並觀察這是否可行,並在網格的庫CSS中進行更改或使用自定義類將其更改爲ovverride。
#gridview tr{
{
height: 18px;text-align: left;font-weight: bold;color:white;padding: 5px 6px 2px;border-bottom: 2px solid #666666;white-space: nowrap;
}
使用填充在th和td,
th, td {
padding: 15px;
}