美文网首页
0.5px border tag

0.5px border tag

作者: jiansheng | 来源:发表于2018-11-29 22:28 被阅读0次

兼容ios和安卓主流浏览器
示例链接:https://codesandbox.io/s/40n998y2x

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .title {
            font-size: 16px;
        }

        .tag {
            display: inline-block;
            height: 14px;
            margin-right: 4px;
            vertical-align: 2px;
        }

        .tag-content {
            position: relative;
            height: 100%;
            font-size: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 3px;
        }

        .tag-content:after {
            content: "";
            display: block;
            position: absolute;
            top: -50%;
            right: -50%;
            bottom: -50%;
            left: -50%;
            border: solid 1px;
            transform: scale(0.5);
            border-radius: 6px;
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <div class="title">
        <span class="tag">
            <span class="tag-content">标签</span>
        </span>标题标题标题标题标题标题标题</div>

    <div class="title">
        <span class="tag">
            <span class="tag-content">标签</span>
        </span>标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题</div>
</body>

</html>
ios safari浏览器中的效果 安卓 UC浏览器中的效果

相关文章

网友评论

      本文标题:0.5px border tag

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