标签的DIV卧式和垂直对齐的表行 [英] horizonal and vertical alignment of label in div in table row

查看:705
本文介绍了标签的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;

这篇关于标签的DIV卧式和垂直对齐的表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆