如何设置为Css我的文本在Div中间? [英] How Can I Set To Css That My Text In Div Be In Middle?

查看:335
本文介绍了如何设置为Css我的文本在Div中间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.type1
{
text-align:center;
width:100px;
height:100px;
background:yellow;
border:5px solid red;
position:absolute;top:30px;left:500px;
}
<div class="circleBase type1"><p>صفحه اصلی</p></div>



如何设置为css我的div中的文字位于中间


how can i set to css that my text in div be in middle

推荐答案

尝试这样的行高:

Try line-height like this:
.type1 {
    text-align: center;
    line-height: 70px;
    width: 100px;
    height: 100px;
    background: yellow;
    border: 3px solid red;
}


这篇关于如何设置为Css我的文本在Div中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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