如何仅向按钮区域添加背景颜色?

时间:2013-09-11 01:14:24

标签: jquery css jquery-ui jquery-ui-dialog

如果我将background:#e7eef9;添加到jQuery("#div_element").dialog,则会将其附加到整个对话框。我怎样才能将其附加到buttons区域?

function test(buttonEl)
{
    jQuery("#div_element").dialog({
         resizable: false,
         height:200,
         modal: true,
         width: 300,
         buttons: {
            Cancel: function() {
                 jQuery( this ).dialog( "close" );
            }
         }
    });
}

1 个答案:

答案 0 :(得分:3)

使用general sibling combinator ~

CSS:

#div_element ~ .ui-dialog-buttonpane button {
    background: e7eef9;
}