美文网首页
css实现中间文字 两端横线的两种方法(使用标签)

css实现中间文字 两端横线的两种方法(使用标签)

作者: 郭先生_515 | 来源:发表于2019-04-16 16:47 被阅读0次

根据题意要实现的效果如图:


image.png

要使用标签,那就是 fieldset 和 legend

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>css实现中间文字 两端横线的两种方法</title>
    <style>
        fieldset {
            border: none;
            border-top: 1px solid #ccc;
            text-align: center;
            width: 240px;
            margin: 0 auto;
        }
        legend {
            padding: 0 10px;
            color: #ccc;
            font-size: 16px;
        }
    </style>
</head>
<body>
    <fieldset><legend><span>登录</span></legend></fieldset>
</body>
</html>

相关文章

网友评论

      本文标题:css实现中间文字 两端横线的两种方法(使用标签)

      本文链接:https://www.haomeiwen.com/subject/arzbwqtx.html