Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iconCls in a button text alignment - EXTJS

var btnLogin = new Ext.Button({
             text: 'Login',
             scale   : 'large',
             width : 100,
             iconCls: 'checkicon',
             iconAlign: "right",

             handler: function(){
               if(Ext.getCmp('username').getValue() !== '' && Ext.getCmp('password').getValue() !== ''){
                 loginForm.getForm().submit({
                   url: 'authenticate.php',
                   method: 'POST',
                   params: {
                     response: hex_md5(Ext.getCmp('challenge').getValue()+hex_md5(Ext.getCmp('password').getValue()))
                   },
                   success: function(){
                     window.location = 'tabs-adv.html';
                   },
                   failure: function(form, action){
                     Ext.MessageBox.show({
                       title: 'Error',
                       msg: action.result.message,
                       buttons: Ext.Msg.OK,
                       icon: Ext.MessageBox.ERROR
                     });
                   }
                 });
               }else{
                 Ext.MessageBox.show({
                   title: 'Error',
                   msg: 'Please enter user name and password',
                   buttons: Ext.Msg.OK,
                   icon: Ext.MessageBox.ERROR
                 });
               }
             }
           })

enter image description here

Question

The Login and the check icon gap are too much, how to let the check icon and the Login text stick together,or let the iconCls align to left abit.

UPDATE

.checkicon {
    margin-right: 25px;
    background-image:url(../images/CheckIcon.png) !important;
}
like image 992
John Walker Avatar asked Nov 13 '22 11:11

John Walker


1 Answers

This is a bit tricky because the button icons are absolutely positioned within the button. You can try something like this in your .checkicon class:

.checkicon {
    right: -25px !important
    background-image:url(../images/CheckIcon.png) !important;
}

This should achieve the same effect that you are looking for with margin-right.

like image 147
bfuoco Avatar answered Nov 14 '22 23:11

bfuoco