1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    102
    Answers
    1
    Vote Rating
    1
    sj_tt6 is on a distinguished road

      0  

    Default Unanswered: Config background image to fit the button

    Unanswered: Config background image to fit the button


    Hi,

    I have a push button and set its iconCls: 'icon-myimage'. I define in the css file the icon-myimage class as below:

    Code:
    .icon-myimage{background-image: url(../icons/myimage.png); background-size: cover; height:auto; width:auto; max-width:100%; max-height:100%}
    The image displays very small in the button. I see in the debug window
    Code:
    .x-btn-default-small-icon .x-btn-icon {
    
    
    • width: 16px;
    • height: 16px;
    • top: 0;
    • left: 0;
    • bottom: 0;
    • right: 0;
    }
    I don't know how these classes are added automatically to my icon. If I disable width & height (16px) in the debug window then the icon fills up the button.

    I'm sure there is a way to config the css or in extjs javascript. Can somebody show me how to fix this problem? Thank you!

    Regards,

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Answers
    3542
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Those classes are from the CSS that comes with Ext JS. Your classes need to come before or use the same classes as the default ones to override them.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,605
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    The button CSS is quite delicate, generally you'd just specify a background image and no-repeat for the icon.

    To set the icon size:

    http://docs.sencha.com/ext-js/4-1/#!...tton-cfg-scale

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Posts
    102
    Answers
    1
    Vote Rating
    1
    sj_tt6 is on a distinguished road

      0  

    Default


    Hi,

    I used the scale and it worked. Thank you !

Thread Participants: 2