基于 div 定位
CSS
body {
margin: 0;
}
.ifdisplay {
margin: 0;
overflow: hidden;
min-height: 100vh;
display: -ms-flexbox!important;
display: flex!important;
-ms-flex-align: center!important;
align-items: center;
justify-content: center;
}
img.avatar {
border-radius: 50%;
}
HTML
<div class="ifdisplay">
<img src="https://static.hexingxing.cn/v2/element/webp/nice-highres.png" class="avatar">
</div>
基于 body 定位
CSS
body {
margin: 0;
overflow: hidden;
min-height: 100vh;
display: -ms-flexbox!important;
display: flex!important;
-ms-flex-align: center!important;
align-items: center;
justify-content: center;
}
img.avatar {
border-radius: 50%;
}
HTML
<img src="https://static.hexingxing.cn/v2/element/webp/nice-highres.png" class="avatar">
Demo
https://static.hexingxing.cn/v3/css/relatively_centred_of_div/
https://static.hexingxing.cn/v3/css/relatively_centred_of_body/
友情提示:本站所有文章,如无特殊说明或标注,均为何星星原创发布。与此同时,趋于近年来本站的文章内容频繁被他站盗用与机器采集,现已全局禁用网站文字内容操作,了解详情或转载文章请 点此 继续!
0 条评论