标签的DIV卧式和垂直对齐的表行

问题描述:

我有code:

<tr>
    <td align="center" style="height: 50px; text-align: center; vertical-align: middle"   >
           <div class="hoverClass ui-widget-content ui-corner-all" style="text-align: center; vertical-align: middle;width:100%;height:100%">
                 <label style="text-align: center; vertical-align: middle" >Streetlight Repair</label>
           </div>
     </td>
</tr>

我希望它是用含标签的DIV的单元格。 我想股利占用整个小区。并要在专区内集中的标签。然而标签坐在的div左上方。

I want it to be a cell with a div containing a label. I want the div to take up the whole cell. and the label to be centered within the div. However the label sits at the top left of the div.

任何想法?

如果高度肯定是50像素,设置标签的行高的CSS 50像素;

If the height is definitely 50px, set the line-height CSS of the label to 50px;

要获得在中间水平的标签,设置保证金左:自动;和保证金右:自动;

To get the label in the middle horizontally, set margin-left:auto; and margin-right:auto;