【发布时间】:2013-07-15 05:50:30
【问题描述】:
我正在尝试使所有这些按钮的大小相同,其中两个因文本而变大。
这可以使用 CSS 吗?
【问题讨论】:
标签: jquery css jquery-mobile button
我正在尝试使所有这些按钮的大小相同,其中两个因文本而变大。
这可以使用 CSS 吗?
【问题讨论】:
标签: jquery css jquery-mobile button
如果这是一个 jQuery Mobile 问题,那么可以通过更改此类来更改按钮大小:
.ui-btn {
width: 200px !important;
}
!important 对于 jQuery Mobile 是必需的,因为我们需要覆盖默认值。
工作示例:http://jsfiddle.net/Gajotres/NJ8q4/
现在,因为您使用的是标签按钮(我在您之前的问题中是这样),您需要给它一个自定义 id 或类。如果您只更改 .ui-btn,您将更改应用程序中的每个按钮。所以最终这个 CSS 将与这个 HTML 一起工作:
<a data-role="button" class="custom-btn">Level 5</a>
<a data-role="button" class="custom-btn">Level 4</a>
<a data-role="button" class="custom-btn">Level 3</a>
<a data-role="button" class="custom-btn">Level 2</a>
<a data-role="button" class="custom-btn">Level 1</a>
<a data-role="button" class="custom-btn">Stretch</a>
<a data-role="button" class="custom-btn">Warm up</a>
.custom-btn {
width: 200px !important;
}
【讨论】: