css - 如何为 Jquery UI 按钮定义自定义 css

标签 css asp.net

我在不同的页面上使用 JQuery UI 按钮并尝试删除某些页面上的 Angular 。

我已经定义了以下 css,它工作正常,但它会影响其他页面上的其他按钮。我只对所有网页使用一个样式表。

是否可以只影响那些在 cssbox 表中定义的按钮?

 <table class="cssbox" cellpadding="5" cellspacing="0" border="0" width="398px" style="height: 287px;margin:0 auto;">
    <tr><td>
    <asp:Button ID="btnLogin"  Text=" Login " runat="server" CssClass="ui-corner-all ui-corner-all hover"  />

   </td> </tr>
 </table>

.cssbox ui-corner-all { 
width:265px;
border-radius: 0px; 
background: none repeat scroll 0% 0% #1A7BC9;
background: linear-gradient(to bottom, #1A7BC9 0px, #1A7BC9 100%);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#1A7BC9', endColorstr='#1A7BC9');/*For IE7-8-9*/ 
border: 1px solid #1A7BC9;
height: 35px;
font-size: 12px;
}

.cssbox ui-corner-all:hover { 
border-radius: 0px; 
background: none repeat scroll 0% 0% #9CC8F7;
color: #404040;
border: 1px solid #9CC8F7;
filter: none;
}

或者可以在 jquery 函数中完成,因为我在某些页面上使用以下函数在 jquery UI 按钮上添加自定义图标。有一个带有 jquery 的删除和添加功能,但它适用于类“cssbox”吗?我不想为不同的页面创建单独的 jquery 函数。

$(function () {
$("input:submit").button({
    icons: { primary: 'cssbox-okbtn' }
}).hide().after('<button>').next().button({
    icons:
    {
        primary: 'cssbox-okbtn'
    },
    label: $("input:submit").val()
}).click(function (event) {
    event.preventDefault();
    $(this).prev().click();
});

});

最佳答案

在你想要删除特定样式的 jquery ui 的页面中,将“removeCorners”类应用于按钮元素:

$('button').addClass('removeCorners');

CSS

.removeCorners {
    /* your custom style */
}

关于css - 如何为 Jquery UI 按钮定义自定义 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27228479/

相关文章:

c# - BeginLifetimeScope/DbContext 的 Autofac 和内存泄漏已被处理/C# asp.net

javascript - 获取/设置 asp :textbox values from javascript

c# - ASP.net MVC 获取当前 View 引擎

c# - 如何结束用户 session 并确保用户已注销?

css - 在 css 中使用 starts with selector 是否有效?

html - 页脚不是居中文本

jquery 选择 float 子项的每个 "row"

asp.net - 云中的 Windows 服务

JQuery 动态添加的 DOM 丢失(不)CSS 样式

jquery - 如何制作 ( :hover:before) pseudo elements remain in effect while drop-down menu is open?