问题描述
|
我已经在样式表中设置了按钮填充,这可以在我的XP机器上使用。但是,当我将其移至2003服务器时,“文本”和按钮边框之间的填充确实很大。
<asp:Content ID=\"Content2\" ContentPlaceHolderID=\"ContentPlaceHolder1\" runat=\"server\">
<asp:UpdatePanel ID=\"UpdatePanel1\" runat=\"server\">
<ContentTemplate>
<table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-left: 15px;\">
<tr class=\"TableHeader\">
<td>
Computer Name
</td>
<td>
First Name
</td>
<td>
Last Name
</td>
<td rowspan=\"2\" style=\"padding-left: 20px\">
<asp:Button ID=\"btnSearch\" runat=\"server\" Text=\"Search for approved computers\" OnClick=\"btnSearch_Click\" />
</td>
</tr>
<tr>
<td style=\"padding-right: 10px\">
<asp:TextBox ID=\"txtComp\" runat=\"server\" Width=\"120px\" MaxLength=\"20\"></asp:TextBox>
</td>
<td style=\"padding-right: 10px\">
<asp:TextBox ID=\"txtFirst\" runat=\"server\" Width=\"120px\" MaxLength=\"50\"></asp:TextBox>
</td>
<td style=\"padding-right: 10px\">
<asp:TextBox ID=\"txtLast\" runat=\"server\" Width=\"120px\" MaxLength=\"50\"></asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
CSS文件:
.TableHeader
{
font-size: 12px;
color: #006400;
text-align: center;
}
.ButtonPadding
{
padding: 2px 5px 2px 5px;
}
我使用IE 8开发人员工具检查了按钮设置,看起来不错,但实际显示却不正确。解决方法
我在样式表中看到了“ 2”字样,但是它没有出现在您提供的HTML代码中的任何地方,因此我们不怀疑它没有工作。
您需要在要应用的元素上指定“ 3”。,好。我想我知道了,实际上用Google搜索了。对于遭受相同问题的任何人,问题都在于IE的“兼容性视图”设置。一旦我将其关闭,一切都会按预期显示。
进一步的搜索发现了这一点:support.microsoft.com/kb/956197现在我可以在IIS中进行设置,无需担心更改组策略。,我看不到您将按钮设置为哪个CSS。
<asp:Button ID=\"btnSearch\" runat=\"server\" Text=\"Search for approved computers\" OnClick=\"btnSearch_Click\" />
CssClass= \"ButtonPadding\" is missing
另外,如果您不想指定将自动应用的CSS,那么您的CSS应该看起来像...
input[type=text],input[type=password] {
padding: 2px 5px 2px 5px;
}