我在 ASP 页面上使用 Jquery mobile,我无法更改背景颜色。 尝试使用以下代码,没有运气。我如何更改 jquery mobile 中 asp 按钮的背景颜色。
<div class="ui-body ui-body-b" >
<div class="ui-grid-a" >
<div class="ui-block-a" >
<asp:Button ID= "Button1" runat="server" Text="Clear"
data-role="button" class="custom-btn" />
</div>
<div class="ui-block-b" >
<asp:Button ID="Button2" runat="server" Text="Submit"
data-role="button" />
</div>
</div>
</div>
.ui-grid-a .ui-block-a .ui-btn.Button1 .ui-btn-inner
{
background: green !important;
}
ui-body.ui-body-b .ui-grid-a .ui-block-a .custom-btn .ui-btn-inner
{
color: green !important;
}
最佳答案
奥马尔在他的评论中给了你正确的答案。 asp.net 按钮呈现为 HTML 作为 <input>
然后 jQM 通过将它包围在 <div>
中来“增强”它使用一类 ui-btn 并隐藏 <input>
.因此,要更改背景颜色,您实际上需要更改 ui-btn div 样式。
将 CssClass 应用于 ASP.Net 控件将无效。相反,在客户端尝试 Omar 的建议:
div.ui-btn {
background-color: green !important;
background-image: none !important;
}
在 jQM 1.3 中,渐变是在 background-image 中实现的。如果你想定位一个特定的按钮,你可能想为它的容器分配一个 ID,然后使用 #containerid .ui-btn{}
关于javascript - 带有 ASP 按钮背景颜色更改的 jQuery Mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22150274/