CSS sencha 中的按钮背景颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10023676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 03:30:58  来源:igfitidea点击:

Button background color in sencha

csssencha-touch

提问by Akshatha

I am new to sencha touch. How do we change the background color of a button to white? I have a button with two images in each corner. I want the button to be plain white. I tried using css like this:

我是煎茶触摸的新手。我们如何将按钮的背景颜色更改为白色?我有一个按钮,每个角都有两个图像。我希望按钮是纯白色的。我尝试使用这样的 css:

.quest {
background: url(../images/quest.jpg) no-repeat left,
       url(../images/rightarrow.jpg) no-repeat right;
       background-color: white;
       border: none;
       border-color:white;
       padding-left: 50px;
       text-align: left;
}

My button is here:

我的按钮在这里:

{
    xtype: 'button',
    text: '<div class="quest">Info</div>',
    labelWidth: '100%',
    name: '',
    handler: function() {                 
    }
}

My button has grey borders (Grey default button color in sencha) with white color in mid. How do i make it completely white? Please help.

我的按钮有灰色边框(sencha 中的灰色默认按钮颜色),中间为白色。我如何使它完全变白?请帮忙。

I have even tried:

我什至尝试过:

style: "background-color: white" 

回答by Akshatha

Using 'cls' attribute solved my problem.

使用 'cls' 属性解决了我的问题。

               {

                   xtype: 'button',
                   cls: 'btn',
                   text: '<div class="person">People</div>',
                   labelWidth: '100%',


                },

In my app.css define

在我的 app.css 中定义

.btn
{
background-color: white !important;
background-image: none;
}

We have to redefine both background-color and background-image properties so that the default sencha-touch.css properties are overridden. Thank you Thiem Nguyen for your help.

我们必须重新定义 background-color 和 background-image 属性,以便覆盖默认的 sencha-touch.css 属性。感谢 Thiem Nguyen 的帮助。

回答by fuzzyLikeSheep

Just like Thiem Nguyen said, this will work

就像 Thiem Nguyen 说的,这会奏效

           {
                xtype:'button',
                text:'text',
                ui:'plain',
                style:'background-color:white'
            }

回答by Thiem Nguyen

This should render your desired button :)

这应该呈现您想要的按钮:)

config: {
        ui: 'plain',
        text: 'Your Text',
        style: 'background-color:white;'
    }