asp:IE7 中的按钮宽度问题,由于某种原因向左侧添加了额外的 100px?
由于某种原因,IE7 中的 asp:button 在按钮左侧添加了额外的 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>
CSS
input[type="submit"] {
background: url("../images/arrow.png") no-repeat left red;
color: #006aae;
float: left;
text-align: left;
display: block;
width: auto;
margin-left: 10px;
text-indent: 40px;
}
input[type="submit"]:hover {
color: #009CFF;
cursor: pointer;
}
For some reason the asp:button's in IE7 add an extra 100px's (or so...) to the left of the button. this creates a problem for my css styling. Sure, I could go in and overwrite each individual button by giving it exact pixel dimensions.., but that would be a pain in the ass since the application my companies building has nearly 50 pages involved with about 10 buttons per page (you can do the math!). I would much rather let asp:button grow as it needs to depending on the size/width of the text.
Any help would be much appreciated.
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>
CSS
input[type="submit"] {
background: url("../images/arrow.png") no-repeat left red;
color: #006aae;
float: left;
text-align: left;
display: block;
width: auto;
margin-left: 10px;
text-indent: 40px;
}
input[type="submit"]:hover {
color: #009CFF;
cursor: pointer;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个已知问题,例如请参阅 删除 IE 按钮中的额外填充 并作为您在评论中提到解决方案如下:
对于跨浏览器的任何其他有趣的问题,更强大的解决方案是使用 CSS reset/base:
尝试这个(我能找到的唯一一个解决此问题的解决方案)特定的 IE 错误直接): http://blog.teamtreehouse.com/setting-rather -比重置默认样式,
CSS 基础: http://tjkdesign.com/ez-css/css/base.css
This is a known issue, e.g. see Remove extra padding in IE button and as you mentioned in the comments the solution looks like:
A more robust solution for any other funnies across browsers is to use a CSS reset/base:
Try this one (the only one that I could find that address this specific IE bug directly): http://blog.teamtreehouse.com/setting-rather-than-resetting-default-styling ,
CSS base: http://tjkdesign.com/ez-css/css/base.css