浅鱼

div中同一行的img、span垂直居中的问题
html代码<l <span class="left_item">在...
扫描右侧二维码阅读全文
13
2019/01

div中同一行的img、span垂直居中的问题

html代码

<li>
    <span class="left_item">在线</span>
    <img class="right_item item_img"  src="../../assets/admin/image/ztree_forbid.png" alt=""/>
</li>

相关css

.left_item {
    width: 30%;
    height: 100%;
    display: inline-block;
    box-sizing: border-box;
    vertical-align: middle;
}

.right_item {
    width: 40%;
    height: 100%;
    display: inline-block;
    box-sizing: border-box;
    vertical-align: middle;
}

.item_img{
    width: 40px;
    height: 40px;
}

li {
    padding: 5px 10px;
    width: 100%;
    vertical-align: middle;
    box-sizing: border-box;
    display: block;
}

重点在于:整的li与li中的左右两个item都用:

vertical-align: middle;
Last modification:January 13th, 2019 at 02:14 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment