块元素 居中

复制代码
element.style {
    width: 128px;
    height: 128px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -64px;
    margin-left: -64px;
}
复制代码

 未知子元素宽高

复制代码
//父元素
element.style {
    display: flex;
}
//子元素
element.style {
    margin: auto;
}

<li style="width: 33.3%;" data_url="Navig/MatterInfos" data_id="18"><div style="background-color: #F874A4;height: 400px;display: flex;">
<div style="margin: auto;">
<img src="/uploadFiles/Image_ico\2019-10-14\20191014150744429.png" style="height: 80px;margin: auto;"><span>xxx</span>
</div>
</div>
</li>

复制代码

出处 :https://www.cnblogs.com/Youngly/p/6796922.html

posted @   enych  阅读(211)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示