我在一个项目中使用了 jQuery UI 按钮,它们运行良好。
但是,在 IE7 中,图标不会像应有的那样浮动。我意识到 IE 还没有圆角支持,但这没关系。
好的浏览器有些浏览器渲染得很好
IE烂版本 7 不会:
我从 HTML 中的一个按钮开始
<button type="submit"><span class="ui-icon ui-icon-mail-closed"></span>Send</button>
然后我遍历按钮,在每个按钮上使用一点点 jQuery
$('#content button').each(function() {
var icon = $(this).find('span.ui-icon');
var primaryIcon = icon.attr('class').replace(/ui-icon\s?/, '');
icon.remove();
$(this).button({ icons: {primary: primaryIcon }, label: $(this).text() });
});
我只是在拜访button()
他们,但我决定这样做是为了确保我按照设计的方式使用库。
我在图标上也有一些 CSS
button span.ui-icon {
display: inline;
float: left;
margin-right: 0.1em;
}
上面的页面也可用。(我希望缩短为无效的 HTTP 引荐来源网址)。
我究竟做错了什么?
非常感谢!
更新
根据Meder 的回答,我尝试将图标制作为内联块元素。
button span.ui-icon {
display: inline;
float: left;
margin-right: 0.1em;
margin-top: -1px;
/* get rid of margin for inline element */
#margin: auto;
/* this should revert the element to inline as per declaration above */
#float: none;
/* hasLayout = true */
#zoom: 1;
}
然而,这具有使按钮元素消隐的不同寻常的影响!
我该怎么办?