jQuery移动按钮大小?

Nat*_*man 6 css jquery button jquery-mobile

我正在尝试使所有这些按钮的大小相同,因为文本,两个按钮更大.

这可能使用CSS吗?

在此输入图像描述

Gaj*_*res 10

如果这是一个jQuery Mobile问题,那么可以通过更改此类来更改按钮大小:

.ui-btn {
    width: 200px !important;
}
Run Code Online (Sandbox Code Playgroud)

!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>   
Run Code Online (Sandbox Code Playgroud)

CSS:

.custom-btn {
    width: 200px !important;
}
Run Code Online (Sandbox Code Playgroud)

第二个工作示例:http://jsfiddle.net/Gajotres/NJ8q4/1/