jQuery Mobile 按钮大小?

标签 jquery css jquery-mobile button

我试图让所有这些按钮的大小相同,其中两个更大,因为文字。

这可以使用 CSS 吗?

enter image description here

最佳答案

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

关于jQuery Mobile 按钮大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17686867/

相关文章:

javascript - 确定 Chrome 中当前 DOM 元素状态

javascript - 如何在按回车键使用 contenteditable 时多次提交表单

css - 使用 KO "if"绑定(bind)时如何删除包含字段的边框?

javascript - 如何在 jquery mobile 中打开一个外部 html 页面作为弹出窗口?

javascript - 这是你在 jQuery 中定义函数的方式吗?

jquery - 验证至少一个复选框(多组复选框)

javascript - 如何更改页面和维护导航栏

html - 如何在表格中包含一个div

html - 在 Bootstrap3 中,如何使轮播字幕具有 50% 不透明度的背景?

android - 用于移动 Web 应用程序的 Titanium 还是 PhoneGap?