更改jQuery UI按钮大小? [英] Changing jQuery UI Button size?
问题描述
我一直在我的页面上使用jQuery UI按钮,但是我还没有找到解决似乎是一个简单问题的方法。我希望我的一些按钮比另一些小,这应该像设置按钮文本的CSS一样简单, font:.8em;
但是jQuery UI将您的DOM元素包装起来:
I've been using the jQuery UI button all over my page, however I haven't found a way around what seems to be a simple problem. I want some of my buttons to be smaller than the other, this should be as simple as setting the CSS of the button text to something like, font: .8em;
However jQuery UI takes your DOM element and wraps it:
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all">
<span class="ui-button-text">Button Label</span>
</button>
所以如果我有一个< button class =small-button >小按钮!< / button>
jQuery会将文本放在子跨度中。给予小按钮
类的任何字体大小都将被忽略。
So if I have a <button class="small-button">Small button!</button>
jQuery will place the text in a child span. Any font size given to the small-button
class will be ignored.
必须要解决这个问题。没有破解jQuery如何制作按钮。有什么想法吗?
There's got to be a way around this without hacking at how jQuery makes its buttons. Any ideas?
推荐答案
如果它的样式 ui-button-text
with直接 font-size
,您可以通过应用!important来覆盖更高级别。例如:
If it's styling ui-button-text
with font-size
directly, you can override it at a higher level by applying !important. Such as:
.small-button {
font-size: .8em !important;
}
编辑:尝试直接在上设置CSS样式。 ui-button-text
继承:
try setting a CSS style directly on .ui-button-text
to inherit:
.ui-button-text {
font-size: inherit !important;
}
这也应该使上的!重要。小按钮
无关紧要。
这篇关于更改jQuery UI按钮大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!