与&lt垂直文本中心; DIV> [英] vertical text center in <div>

查看:126
本文介绍了与&lt垂直文本中心; DIV>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我试图让2 DIV-容器,既应包含居中的文本(x轴和y轴)。

So i am trying get 2 div-containers which both should contain centered text (Both x- and y-axis).

由于谷歌和计算器,我绊了一些解决方法而玩垂直对齐等,但似乎没有任何工作。

Thanks to Google and stackoverflow, i stumbled over a few workarounds which play with vertical-align etc. But nothing seems to work.

#right-menu {
    position: absolute ;
    right: 0% ;
    top: 0% ;
    height: 100% ;
    width: 5% ;
    text-align:  center ;
    background: #ededed ;
        display: table-cell;

vertical-align: middle ;

下面是一个小提琴:

http://jsfiddle.net/7Rgvs/

推荐答案

垂直对齐:中间属性没有与使用的位置是:绝对的; 如果您使用的是垂直对齐:中间那就试试这个布局修改布局 http://jsfiddle.net/7Rgvs/5/

Vertical-align:middle property is not used with position:absolute; if you are using vertical-align:middle then try this layout modified layout http://jsfiddle.net/7Rgvs/5/

这篇关于与&lt垂直文本中心; DIV>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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