PDA

View Full Version : Aligning a buton



webfriend13
11 Mar 2012, 11:24 PM
Hi all,

I have a window with border layout. In the south section, I have added a button. I want to place this buton on the right side of the window. But by default it is coming to the left of the window. I also want to apply padding and margin. This is how i have added button:

{
xtype: 'panel',
height: 50,
region: 'south',
items: [{
xtype: "button",
id: "button-close",
text: "Close"

}]
}

Kindly suggest what needs to be done. Is it a good idea to use css class. It would be great if you could tell how to do this inline as well as through css.

Thanks in advance.

vietits
11 Mar 2012, 11:34 PM
Try to use hbox layout with pack set to 'end'.


{
xtype: 'panel',
height: 50,
region: 'south',
layout: {
type: 'hbox',
pack: 'end'
},
items: [{
xtype: "button",
id: "button-close",
text: "Close"
}]
}

webfriend13
12 Mar 2012, 12:05 AM
Hi,

Thank you for quick reply. But can I provide margin and padding to button?

vietits
12 Mar 2012, 12:11 AM
I think margin and padding are still applied for button because they are button's config.