6

これらのボタンをすべて同じサイズにしようとしています.2つはテキストのために大きくなっています.

これはCSSを使用して可能ですか?

ここに画像の説明を入力

4

1 に答える 1

10

これが 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;
}

2番目の実例: http://jsfiddle.net/Gajotres/NJ8q4/1/

于 2013-07-16T21:05:08.737 に答える