简体   繁体   中英

Custom CSS in Sencha Touch 2 app

Quick question, I've been trying to change the background color and the background image of my Sencha Touch views but it seems I haven't been able to implement this properly.

I've tried this:

extend:'Ext.form.Panel',
requires: ['Ext.form.FieldSet', 'Ext.form.Password', 'Ext.Label', 'Ext.Img'],

config:{
    title: 'Login',
    style: {
       background: "#000"   
    },

And this:

extend:'Ext.form.Panel',
requires: ['Ext.form.FieldSet', 'Ext.form.Password', 'Ext.Label', 'Ext.Img'],
    alias: 'widget.loginview',
style:{
    background: '#000'
},
config:{
    title: 'Login',

And even by adding a CSS class using cls:

extend:'Ext.form.Panel',
requires: ['Ext.form.FieldSet', 'Ext.form.Password', 'Ext.Label', 'Ext.Img'],
config:{
    title: 'Login',
    cls: 'custom-panel',

where custom-panel is defined as:

.custom-panel{
   background-image: url('../images/bg.jpg');
}

How could I make this work?

Try with baseCls attribute insteed of cls

extend:'Ext.form.Panel',
requires: ['Ext.form.FieldSet', 'Ext.form.Password', 'Ext.Label', 'Ext.Img'],
config:{
    title: 'Login',
    baseCls: 'custom-panel',

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM