在高度不确定的情况下让div自身垂直和水平局中的终极解决方案(CSS3写法)

<div class='contain' ></div>

<style>
.contain {
  position: fixed;
  top: 50%;
  left: 50%;
   600px;
  height: auto;
  transform: translateX(-50%) translateY(-50%);
}
</style>

  

原文地址:https://www.cnblogs.com/JeffreyZhu/p/15758333.html