-
26 Dec 2012 11:03 PM #1
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:
The image displays very small in the button. I see in the debug windowCode:.icon-myimage{background-image: url(../icons/myimage.png); background-size: cover; height:auto; width:auto; max-width:100%; max-height:100%}
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.Code:.x-btn-default-small-icon .x-btn-icon {- width: 16px;
- height: 16px;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
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,
-
29 Dec 2012 8:48 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
- Answers
- 3104
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
31 Dec 2012 12:56 PM #3
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
-
2 Jan 2013 4:15 PM #4
Hi,
I used the scale and it worked. Thank you !


Reply With Quote