如何调整datalist中表格的列宽?我已经尝试通过CSS直接在标签上应用宽度,但它不会影响表格
<asp:DataList ID="DataList2" runat="server" DataSourceID="ObjectDataSource2" Height="409px" RepeatColumns="3" Width="600px" >
<ItemTemplate>
<table class="nav-justified" cellpadding="0" cellspacing="0" >
<tr>
<td><asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("productImage") %>' Width="120" Height="60" /></td>
</tr>
<tr style="width:120px">
<td> <asp:HyperLink ID="HyperLink2" runat="server" CssClass="productName" NavigateUrl='<%# string.Format("product.aspx?id={0}", Eval("productId")) %>'>HyperLink</asp:HyperLink> </td>
</tr>
<tr style="width:120px">
<td><asp:Label ID="Label1" runat="server" class="productPrice" Text='<%# Eval("productPrice") %>' ></asp:Label></td>
</tr>
<tr style="width:120px">
<td> <asp:Button ID="Button1" CssClass="addToCart" runat="server" Text="+" /> </td>
</tr>
</table>
</ItemTemplate>
答案 0 :(得分:0)
问题在于Datalist width属性。更改它使列更接近
<asp:DataList ID="DataList2" runat="server" DataSourceID="ObjectDataSource2" Height="409px" RepeatColumns="3" Width="400px" >
<ItemTemplate>