0

I have a text "2012 Year" in the table, I want to position it centered vertically. There is a collapseIcon beside the text.

The demo.

My questions:

1) Can we position it in the center accurately? Please don't use padding-top, I doubt that it is not accurate since we don't know the hight of the cell.

2) A little off topic, there is no tbody element in the table, why the code

 $('table.collapsible tbody').each(function() {

is still working?

Thank you.

4

2 に答える 2

0

これは CSS プロパティ valign:middle で行うことができます

JQuery を使用して実行する場合は、次のように実行できます。

$('table.collapsible tbody tr td').each(function() {
    $(this).css('valigh','middle');
});
于 2012-08-09T13:05:38.893 に答える
0

に追加line-height: 60px.tabletitleます。の<img>高さは 60px で、テキストは行の高さ 60px の中央に表示されます。

フィドル

于 2012-08-09T13:08:09.657 に答える