【发布时间】:2014-10-20 16:23:58
【问题描述】:
我正在尝试为整个标题文本添加下划线,使其看起来像下面的图片(标记为“试图使它看起来像”)。但它不会在整个标题文本中带有一致的下划线。谢谢你的帮助。
图片中写着:“试着让它看起来像”的部分是我希望它看起来像的样子 图片中“看起来像当前”的部分就是它当前的样子。
代码附在下面
<asp:GridView runat="server" ID="grdvwDepositTransaction"
AutoGenerateColumns="false" DataKeyNames="Status"
OnRowCommand="grdvwDepositTransaction_RowCommand" ShowHeaderWhenEmpty="true" OnRowDataBound="grd_RowDataBound"
CssClass="grid">
<Columns>
<asp:TemplateField>
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DepositEntry.cardNumber" HeaderText="Card Number" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.accountNumber" HeaderText="Account Number" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.firstName" HeaderText="Customer Name" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.transactionDateTime" HeaderText="Transaction Date/Time" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.cashAmount" HeaderText="Cash Amount" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.depositAmount" HeaderText="Envelope Deposit Amount" ItemStyle-CssClass="mediumColumn columnCenter" />
</Columns>
<EmptyDataTemplate>
<br />
<br /><br />
<span style="font-weight: bold; text-anchor:middle;">No Transactions have been entered</span>
</EmptyDataTemplate>
</asp:GridView>
<table class="grid" cellspacing="0" rules="all" border="1" id="MainContent_grdvwDepositTransaction" style="border-collapse:collapse;">
<tr style="text-decoration:underline;">
<th scope="col"> </th><th scope="col">Card Number</th><th scope="col">Account Number</th><th scope="col">Customer Name</th><th scope="col">Transaction Date/Time</th><th scope="col">Cash Amount</th><th scope="col">Envelope Deposit Amount</th>
</tr><tr>
<td colspan="7">
<br />
<br />
<br />
<span style="font-weight: bold; text-anchor:middle;">No Transactions have been entered</span>
</td>
</tr>
</table>
<br />
</div>
</div>
【问题讨论】:
-
HTML 输出是什么样的?使用 CSS 应该很容易做到。
-
这是我的想法!谢谢你看这个。 HTML 输出应该看起来像“看起来像当前图像”。
-
这没有用,我需要查看实际的 HTML。
-
@DavidG 编辑了问题以包含 HTML 渲染参见灰色代码块。
-
您可以使用 CSS 选择器选择表格的第一个 tr,并使用
border-bottom,这实际上会在标题行下方添加一条连续线。