简体   繁体   中英

extJs Button image in Chrome

It seems that Chrome is becomming the new IE when it comes to CSS ~~`

I have following code for creating extjs buttons in an acordion:

                var button = Ext.create('Ext.Button', {
                    text: '<img src="'+resp.sellers.external[key].catalogs[0].logo+'">',
                    handler: function() {
                        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
                    },

                    margin: '3 3 0 3',

                });

Now in FF and IE all looks great like here:

在此处输入图片说明

But in Chrome without the height property it looks like crap:

在此处输入图片说明

And to make it worse when i add the Height property i end up with this:

                var button = Ext.create('Ext.Button', {
                    text: '<img src="'+resp.sellers.external[key].catalogs[0].logo+'">',
                    handler: function() {
                        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
                    },

                    height: 55,
                    margin: '3 3 0 3',

                });

Which gets me this:

在此处输入图片说明

The problem is that ExtJs is generating a padding value in Chrome, which screws the image...

<span id="button-1128-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on" style="line-height: normal; padding-top: 27px;"><img src="logos/logo_mercateo.png"></span>

Now my question is, is there a better aproach to get the image to be show like here in firefox?

在此处输入图片说明

EDIT:

When i try to make it via the icon element i get this:

在此处输入图片说明

A better method to display the image on your button would be to use the appropriate icon parameters available for the Button class :

 var button = Ext.create('Ext.Button', {
                    text: ' ',
                    iconCls:'btImage',
                    handler: function() {
                        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
                    }   
                    ...

                });

Necessary CSS:

btImage {
background-image: url(/images/logo.png) !important;
}

Note:I have not tested the code.. but you can play with icon,iconCls,iconAlign params to achieve what you need

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