jquery buttons do not align properly

Go To StackoverFlow.com

1

Does anyone know how to align these jquery buttons without using float:left?

This problem occurs when <button> and any other elements like <a> are used:

http://jsbin.com/afixij/edit#javascript,html,live

Same problem is also on jquery's website:

http://jqueryui.com/demos/button/#default

2012-04-05 18:21
by Ergec


1

I didn't have this issue before, so I checked my old codes using older versions of jquery-ui. I noticed that old .ui-button class had overflow:visible instead of overflow:hidden Changed it to overflow:visible, voila it's fixed.

2012-04-05 19:08
by Ergec
Congrads :p Gotta love those abstract css tags that give you all sorts of weird behaviour - Alain 2012-04-05 19:11
Latest update http://bugs.jqueryui.com/ticket/824 - Ergec 2012-04-06 11:00


1

It's because the class .ui-button in jquery-ui.css is using display: inline-block;

enter image description here

The problem goes away if you change that to display: inline-table;

enter image description here

2012-04-05 18:28
by Alain
display: inline-table is a Table model values. Not sure it is good to use in this scenario - Selvakumar Arumugam 2012-04-05 18:35
? See http://www.w3schools.com/cssref/prclassdisplay.asp, the purpose of display: inline-table is to display elements as an inline-table, which is perfect when you have something like a series of buttons you want displayed in alignment with each other. inline-block places the element as an inline element (on the same line as adjacent content), but it behaves as a block element - which is the problem here since when rendered visually, block-level elements usually begin on a new line. (See http://htmlhelp.com/reference/html40/block.html - Alain 2012-04-05 18:38
after change, chrome does the same thing : - Ergec 2012-04-05 18:57
Well I hope you'll consider an upvote on an answer that works for ie 7+ and firefox. Honestly, you're always going to run into CSS problems when you're using someone else's hugely complicated CSS libraries and trying to get the same behaviour on all browsers. I recommend dialing back on the number of styles inherited. If you want a workaround, do what display: inline-table is supposed to do - just place your elements in a table: http://jsbin.com/afixij/3/edi - Alain 2012-04-05 19:08
Ads