#modalId{
left: 50%;
top: 50%;
/*transform: translate(-50%,-50%);*/
overflow: visible;
bottom: inherit;
right: inherit;
transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px));
}
深漂小码哥 博主文章分类:Html/CSS/Js/Jq ©著作权
#modalId{
left: 50%;
top: 50%;
/*transform: translate(-50%,-50%);*/
overflow: visible;
bottom: inherit;
right: inherit;
transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px));
}
块级元素,比如 div,其默认宽度是100%。给定一个宽度的时候,可以居中对齐。行内元素(比如文字,span,图片等)的水平居中,其
水平垂直居中是常见的面试题,在不同的场景下使用不同的解决方案才能更加高效。
前端css实现水平居中、垂直居中、水平垂直居中
目录1. 实现盒子水平垂直居中方法一:定位(1)方法二:定位(2)方法三:定位(3)方法四:display
官网faq,解答: 结果:
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M