添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
没人理的油条  ·  How to get the Tab ...·  4 月前    · 
傻傻的地瓜  ·  搜索结果·  10 月前    · 
设置display: inline-block;的标签i与span标签一起会导致元素垂直不对齐,通过给i标签设置伪类before,content的不可为空,从而实现垂直居中。

未设置伪类before

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .head-left .icon-wodeditu{
            background: #5daaff;
            width: 30px;
            height: 30px;
            border-radius: 100%;
            color: #fff;
            line-height: 30px;
            display: inline-block;
            text-align: center;
        .head-left .icon-wodeditu:before{
            /*content: "111";*/
         .head-left .title{
            color: #3c3d3f;
            margin: 0 10px;
            font-size: 16px;
    </style>
</head>
<div class="head-left">
        <i class="icon-wodeditu"></i>
        <span class="title">我的可视化地图</span>
</body>
</html>

设置伪类before

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .head-left .icon-wodeditu{
            background: #5daaff;
            width: 30px;
            height: 30px;
            border-radius: 100%;
            color: #fff;
            line-height: 30px;
            display: inline-block;
            text-align: center;
        .head-left .icon-wodeditu:before{
            content: "111";
         .head-left .title{
            color: #3c3d3f;
            margin: 0 10px;
            font-size: 16px;
    </style>
</head>
<div class="head-left">
        <i class="icon-wodeditu"></i>
        <span class="title">我的可视化地图</span>
</body>
</html>