5
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
                 });
               }
             }
           })

在此处输入图像描述

问题

Login对勾图标间隙太大,如何让对勾图标和登录文字粘在一起,或者让iconCls左对齐。

更新

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

3 回答 3

1

这有点棘手,因为按钮图标绝对位于按钮内。你可以在你的 .checkicon 类中尝试这样的事情:

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

这应该可以达到与您使用 margin-right 相同的效果。

于 2013-02-27T19:44:08.713 回答
0

尽量不要将比例设置为大并删除宽度。它应该自动占用适量的空间。

于 2013-02-22T23:43:53.220 回答
0

您可以将该margin-right属性添加到checkicon CSS 类,使用您选择的值,例如 15px。这样,您的按钮宽度将保持不变,并且只会缩小文本和图标之间的空间。

于 2013-02-23T18:18:42.303 回答