-
23 Oct 2007 7:54 AM #1
Centering Toolbar Items
Centering Toolbar Items
Hello, everyone.
Hopefully, a simple question: is there any quick-and-dirty way to center the content of a Toolbar?
It's left-flush by default, and right-flush if you add a fill. Is there any way to center it?
I've used Firebug to inspect the HTML code that the Toolbar scripts create and tried most of the basic centering tools (display:block and margin:auto, text-align:center, align=center, etc.), but they all seem to be overwritten by the flush-left alignment unless I add a greedy spacer.
I didn't expect this to work, but I also added a second greedy spacer to the other side. Sure enough, no luck.
I'd hardcode margins, but the area that the toolbar is being placed in is relative to the window size, so it would not adjust accordingly.
Thank you very much.
-
23 Oct 2007 10:34 AM #2
Code:myToolbar.getEl().child("table").wrap({tag:'center'})
-
23 Oct 2007 10:51 AM #3
Thank you!
Thank you!
Animal,
Thank You! I was just trying to figure this out today as well!
Joe
-
23 Oct 2007 11:09 AM #4
There is no Dr. Cox quote in existence to describe my appreciation.
Thank you very much. Worked like a charm.
-
25 Mar 2008 12:21 PM #5
Centering Toolbar Items
Centering Toolbar Items
Animal, thanks much! I was actually looking for this as well!!
-
16 Jul 2008 9:58 PM #6
Same problem but different
Same problem but different
Hi,
I have a upper toollbar in a panle. The only element i have in the tollbar is a combo box.
I tried to center the combo box the way you explain. It works on firefox but in IE only the combo box is centered but the combo-list is not. The <center> does not effect the list.
Am i doing something wrong??
-
17 Jul 2008 10:30 AM #7
I think it only affects the box. The list of items inside the combo box itself do not have any way of aligning that I am aware of.
-
25 Jun 2011 5:39 AM #8
You can use flex-config as placeholder to center elements in your toolbar ... in Ext 4:
Code:dockedItems: [{ xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ { xtype: 'component', flex: 0.5 }, { xtype: 'button', text: 'Button 1'}, { xtype: 'component', flex: 0.5 } ] }]
-
27 Jun 2011 12:12 PM #9
-
7 Jun 2012 6:13 AM #10
can you use div tags to align it centre
Tool for 1channel movie watching site


Reply With Quote
