简单的 CSS:
table.tgi
{
width:100%;
}
table.tgi td.labelcell
{
text-align:right;
color:Red;
}
table.tgi td.valuecell
{
text-align:left;
color:Green;
}
简单的 HTML:
<table id="tgi" runat="server" width="100%">
<tbody>
<tr>
<td class="labelcell">ID:</td>
<td></td>
<td class="labelcell">Originator:
</td>
<td class="valuecell"><asp:Button ID="Button1" runat="server" Text="Button" /></td>
</tr>
<tr>
<td class="labelcell">Expected Ship Date:</td>
<td class="valuecell"><asp:TextBox ID="txtExpectedShipDate" runat="server"></asp:TextBox></td>
<td class="labelcell">Actual Ship Date:</td>
<td class="valuecell"><asp:TextBox ID="txtActualShipDate" runat="server"></asp:TextBox></td>
</tr>
</tbody>
</table>
但是TD样式不起作用...
编辑
我试过这个:
table#tgi
{
width:100%;
}
table#tgi td.labelcell
{
text-align:right;
color:Red;
}
table#tgi td.valuecell
{
text-align:left;
color:Green;
}
使用 HTML:
<table id="tgi" runat="server">
<tbody>
<tr>
<td class="labelcell">ID:</td>
<td class="valuecell"></td>
<td class="labelcell">Originator:</td>
<td class="valuecell"><asp:Button ID="Button1" runat="server" Text="Button" /></td>
</tr>
<tr>
<td class="labelcell">Expected Ship Date:</td>
<td class="valuecell"><asp:TextBox ID="txtExpectedShipDate" runat="server"></asp:TextBox></td>
<td class="labelcell">Actual Ship Date:</td>
<td class="valuecell"><asp:TextBox ID="txtActualShipDate" runat="server"></asp:TextBox></td>
</tr>
</tbody>
</table>
这不起作用...但是如果我将它更改为一个类它可以工作...但是我想用一个 ID 尝试它???