2013-02-25 28 views
0

我修改了一點ui-button類的高度,但文本按鈕仍然在它的底部。我如何將它與中間對齊?如何垂直對齊jQuery按鈕文字?

.ui-button { 
    display: inline-block; 
    position: relative; 
    padding: 0px; 
    margin-right: 0.1em; 
    cursor: pointer; 
    text-align: center; 
    overflow: visible; 
    // resize a bit the height 
    height: 20px; 
} 

vertical-align沒有工作。

http://jsfiddle.net/PM4T6/

+0

你可以用jsfiddle創建一個演示嗎? – 2013-02-25 08:07:42

+0

嘗試頂部,右側,左側和底部css規則,因爲您爲此dom設置了位置。 – 2013-02-25 08:11:15

+0

小提琴添加... – anmarti 2013-02-25 08:15:46

回答

2

的.ui鍵{線高度:20像素;}

+0

沒有工作。請檢查我的小提琴:http://jsfiddle.net/PM4T6/2/ – anmarti 2013-02-25 08:19:00

+0

使用較少的字體大小。例如:10px。刪除行高並添加填充:5px; – Rajiv007 2013-02-25 08:22:13

0

當使用position務必註明topleftbottomright ....

0

試試這個

.ui-button { 
    display: table-cell; 
    position: relative; 
    padding: 0px; 
    margin-right: 0.1em; 
    cursor: pointer; 
    text-align: center; 
    overflow: visible; 
    height: 50px; 
}