Jquery UI 单选按钮无缘无故地分离
这是 JS Fiddle 上的该问题的现场演示。我有一些 jquery UI 单选按钮,通过在 body 元素上设置字体系列,按钮集之间突然出现空格,破坏了按钮的外观和连接性。它们看起来像这样:
更新:该错误现在在所有浏览器中都会发生,尽管在每个浏览器。在所有情况下,font-family 属性都是问题所在。
我在我的网站中添加了一些导致问题的最小 CSS/HTML,即我网站的 Themeroller CSS。您可以摆弄小提琴,当从 body
标记中删除 font-family 标记时,您会看到间隙消失。请注意,它不一定是 body
标记,如果将其设为 div
或任何其他适用于单选按钮的内容,就会发生这种情况。
这一点 CSS 就足以破坏它:
body{
font-family: Verdana, Helvetica, Arial, sans-serif;
}
有什么方法可以在不破坏 jquery UI 按钮的情况下为父元素指定字体系列?有趣的是,这个字体系列没有被使用,因为 Jquery UI 主题的 CSS 也设置了单选按钮的字体。
Here's a live demo of the issue on JS Fiddle. I have some jquery UI radio buttons, and by setting the font-family on the body element, suddenly spaces appear between the buttonset, ruining the appearance and connectivity of the buttons. They look like this:
Update: the bug is now happening in all browsers, though slightly different in each browser. In all cases the font-family attribute is the problem.
I included some minimum CSS/HTML from my site that causes the issue, the Themeroller CSS for my site. You can mess with the fiddle and you'll see the gaps disappear when the font-family tag is removed from the body
tag. Note it doesn't have to be a body
tag, it happens if you make it a div
or anything else that applies to the radio buttons.
This one bit of CSS is enough to break it:
body{
font-family: Verdana, Helvetica, Arial, sans-serif;
}
Is there any way I can specify the font family for the parent elements without the jquery UI buttons breaking? Interestingly this font-family isn't being used, as the Jquery UI theme's CSS sets the radio button's font as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法告诉你为什么它会这样做,但如果你乐意添加修复它的 CSS 代码,那么使用这个:
编辑
响应下面的评论 - 尝试将
!important
添加到右边距
;看起来它正在被超越。JS 小提琴 - http://jsfiddle.net/kwpGn/7/
I couldn't tell you why it does it, but if you are happy just to add CSS code that fixes it then use this:
Edit
In response to your comment below - try adding
!important
tomargin-right
; it looks like it is being over-ridden.JS Fiddle - http://jsfiddle.net/kwpGn/7/