我在这里使用GridView遇到了一些困难,一个客户要求我在单元格之间放置一些间距,通常我会使用CellSpacing="5“,但它似乎不起作用,我尝试了一些东西,所有内容都被重写了……
我尝试过的代码:
<asp:GridView ID="gvShoppingCart" runat="server" CellSpacing="5" Width="100%" AutoGenerateColumns="false">
<some-formating-columns-here />
</asp:GridView>实际呈现的是:
<table cellpadding="0" cellspacing="0" summary="">
<thead>
<tr class="AspNet-GridView-Header">
<th scope="col">Produit</th>
<th scope="col"> </th>
<th class="Center" scope="col">Quantité</th>
<th class="Right" scope="col"> Prix Unitaire </th>
<th class="Right" scope="col">Prix</th>
</tr>
</thead>
<body-columns-here />
</table>我不知道现在该添加什么。
有什么建议吗?
发布于 2011-02-07 21:30:10
我假设您正在使用reset.css,因此您可能需要考虑执行以下操作;
在你的css文件中;
table {border-collapse:separate; border-spacing:5px} 边框间距不是跨浏览器的,因此您可能还需要在GridView上添加CellSpacing="5“。
发布于 2009-10-06 18:24:06
你有没有试过使用CSS。如果您知道应用于HTML元素的类,则可以对该特定CSS类使用CSS-padding。我会试一试。
下面是一个例子:
<asp:GridView ID="gvShoppingCart" runat="server" CssClass="gvShoppingFormat" Width="100%" AutoGenerateColumns="false">
<some-formating-columns-here />
</asp:GridView>您的CSS类将如下所示:
.gvShoppingFormat td {
padding-left: 5px;
padding-right: 5px;
}https://stackoverflow.com/questions/1527067
复制相似问题