我试图让所有这些按钮的大小相同,其中两个更大,因为文字。
这可以使用 CSS 吗?
最佳答案
如果这是一个 jQuery Mobile 问题,那么可以通过更改此类来更改按钮大小:
.ui-btn {
width: 200px !important;
}
!important
对于 jQuery Mobile 是必需的,因为我们需要覆盖默认值。
工作示例:http://jsfiddle.net/Gajotres/NJ8q4/
现在,因为您正在使用标签按钮(我从您之前的问题中了解到),您需要为其提供自定义 ID 或类。如果您只更改 .ui-btn,您将更改应用程序中的每个按钮。所以最终这个 CSS 将与这个 HTML 一起工作:
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>
CSS:
.custom-btn {
width: 200px !important;
}
关于jQuery Mobile 按钮大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17686867/