在数据列表中的两列之间放置固定空间
我正在使用数据列表来显示图像。每行有两列,但列之间的间距太小。有没有办法在列之间放置固定间距?
<td class ="DLSettings">
<asp:DataList ID="DlReviewImages" runat="server"
RepeatColumns="2" RepeatDirection="Horizontal"
HeaderStyle-VerticalAlign="Top">
<ItemTemplate>
<table >
<tr>
<td colspan="2">
<table cellspacing="0" cellpadding="0" border="0" class="tableborder">
<tr>
<td align="center">
<a href="" target="_blank" runat="server" id="AImage">
<img runat="server" id="ThumbnailReviewImage" width="250" height="200" border="0"/> </a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</td>
CSS:
.DLSettings{
border-width:1px;
border-color:Black;
border-style:solid;
background-color: #E3E3E3;
padding:5px 10px 30px 30px;
}
提前感谢
BB
I'm using a datalist to display images. There are two columns per row but the spacing between the columns is too little. Is there a way to place a fixed spacing between the columns?
<td class ="DLSettings">
<asp:DataList ID="DlReviewImages" runat="server"
RepeatColumns="2" RepeatDirection="Horizontal"
HeaderStyle-VerticalAlign="Top">
<ItemTemplate>
<table >
<tr>
<td colspan="2">
<table cellspacing="0" cellpadding="0" border="0" class="tableborder">
<tr>
<td align="center">
<a href="" target="_blank" runat="server" id="AImage">
<img runat="server" id="ThumbnailReviewImage" width="250" height="200" border="0"/> </a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</td>
CSS :
.DLSettings{
border-width:1px;
border-color:Black;
border-style:solid;
background-color: #E3E3E3;
padding:5px 10px 30px 30px;
}
Thanks in advance
BB
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只需使用
CellPadding
属性来增加列之间的间距:您也不需要
ItemTemplate
中的任何一个表。它们只是占用空间并减慢速度。尝试使用ItemStyle
进行对齐:I would just use the
CellPadding
property to increase the spacing between columns:You don't need either of the tables in your
ItemTemplate
either. They're just taking up space and slowing things down. Try using theItemStyle
for alignment instead:您可以在表格单元格的右侧添加填充,因此在 css 中...
You could add padding to the right of the table cells, so in the css...