Aspbutton asp:IE7中的按钮宽度问题,出于某种原因在左边增加了额外的100px?

Aspbutton asp:IE7中的按钮宽度问题,出于某种原因在左边增加了额外的100px?,aspbutton,Aspbutton,由于某些原因,asp:按钮在IE7中添加了一个额外的100px左右。。。在按钮的左边。这给我的css样式设置带来了问题。当然,我可以通过给每个按钮提供精确的像素尺寸来覆盖每个按钮,但这将是一个麻烦,因为我公司开发的应用程序有将近50页,每页大约10个按钮,你可以计算!。我更愿意让asp:button根据文本的大小/宽度按需要增长 任何帮助都将不胜感激 ASPX html <div class="sales-order-buttons"> <asp:Button ID="b

由于某些原因,asp:按钮在IE7中添加了一个额外的100px左右。。。在按钮的左边。这给我的css样式设置带来了问题。当然,我可以通过给每个按钮提供精确的像素尺寸来覆盖每个按钮,但这将是一个麻烦,因为我公司开发的应用程序有将近50页,每页大约10个按钮,你可以计算!。我更愿意让asp:button根据文本的大小/宽度按需要增长

任何帮助都将不胜感激

ASPX html

<div class="sales-order-buttons">
   <asp:Button ID="btnSearchSalesOrders" runat="server" Text="Search Sales Orders" />
   <asp:Button ID="btnViewAssociatedOrders" runat="server" Text="View Associated Orders" />
</div>

这是一个已知的问题,例如,请参阅您在评论中提到的解决方案:

/* this is to fix IE 6 and 7 which create extra right/left padding on buttons
 * IMPORTANT: because IE 6 does not understand the first selector below, you need to apply the class "inputButton" to all input of type="button" in your documents
 * the first declaration is for IE 6 and 7, the second one for IE 6 only, the third one is for all browsers.
 */
button,
input[type="submit"],
input[type="reset"],
input[type="button"],
.inputButton {
  *overflow: visible;
  _width: 0;
  padding: .2em .4em;
}
对于跨浏览器的任何其他搞笑,一个更健壮的解决方案是使用CSS重置/base:

试试这个,这是我能找到的唯一一个直接解决这个特定IE bug的方法:,
CSS基础:

样式表或其他样式表中是否有可能导致其拉伸?按钮上有图像或其他东西吗?你能发布一些代码吗?样式表中没有任何东西能让它这样做,我相信这纯粹是IE7的错误,因为在所有其他浏览器firefox、ie8等中,按钮宽度都是正确的。整个网站都是按钮吗?你能发布一些我可以看的代码吗?在主要问题中添加了aspx和css我明白了!我只是简单地加上:宽度:自动;溢出:可见;到css中的输入[type=submit]!真是松了一口气!,希望这对将来的其他人有帮助;
/* this is to fix IE 6 and 7 which create extra right/left padding on buttons
 * IMPORTANT: because IE 6 does not understand the first selector below, you need to apply the class "inputButton" to all input of type="button" in your documents
 * the first declaration is for IE 6 and 7, the second one for IE 6 only, the third one is for all browsers.
 */
button,
input[type="submit"],
input[type="reset"],
input[type="button"],
.inputButton {
  *overflow: visible;
  _width: 0;
  padding: .2em .4em;
}