如图
body和父盒子高度全部都是0
但是我是设置了
html,body { height:100%;}
但是应该是没有生效?
然后导致整个页面居中也有问题
居中的css代码
.login-container {
position: relative;
width: 100%;
height: 100%;
}
.login-form {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 50%); /*本来是(-50%, -50%) 但是这样直接不可见了*/
width: auto;
height: auto;
}
body和父元素高度为0,那么一般的定位就不起作用了,只能使用fixed,相对于浏览器定位