【问题标题】:jQuery Mobile Button Size?jQuery Mobile 按钮大小?
【发布时间】:2013-07-15 05:50:30
【问题描述】:

我正在尝试使所有这些按钮的大小相同,其中两个因文本而变大。

这可以使用 CSS 吗?

【问题讨论】:

    标签: jquery css jquery-mobile button


    【解决方案1】:

    如果这是一个 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;
    }
    

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

    【讨论】:

    • 太棒了,谢谢它的工作!!我可以以同样的方式定位手风琴吗?
    • 告诉我你想改变手风琴的哪个部分,我会告诉你怎么做。
    • 如果按钮包含图标怎么办?如何用按钮放大图标?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多