百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>html5教程> html中怎样实现文本与标签居中
分享文章到:

html中怎样实现文本与标签居中

发布时间:09/01 来源:未知 浏览: 关键词:

实现办法:

(引荐教程:html教程)

1、文本居中:

text-align: center;
line-height: 100px; (=height)

2、标签居中

margin: 0 auto;   其中0指的是margin-top:0

详细代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>搜索论坛</title>
    <link rel="stylesheet" href="https://www.baidu.com/img/baidu_jgylogo3.gif">
    <style>
        .item1{
            height: 100px;
            width: 100px;
            background-color: red;
            text-align: center;
            line-height: 100px;
            margin: 0 auto;
        }
        .item2{
            height: 100px;
            width: 100px;
            background-color: wheat;
            text-align: center;
            line-height: 100px;
            margin: 100px auto;
        }
    </style>
</head>

<body>
    <div>
         <div>1111</div>
         <div>2222</div>
    </div>
</body>

</html>

以上就是html中怎样实现文本与标签居中的具体内容,更多请关注百分百源码网其它相关文章!

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有150人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板