CSS 使用CSS进行垂直和水平居中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CSS 使用CSS进行垂直和水平居中相关的知识,希望对你有一定的参考价值。

.center {
  position: absolute;
  top:0; right:0; bottom:0; left:0;
  margin: auto;

  left:expression(this.parentNode.clientWidth/2 - this.clientWidth/2   " px");
  top:expression(this.parentNode.clientHeight/2 - this.clientHeight/2   " px");
  
  width: 60%;
  height: 60%;
}

以上是关于CSS 使用CSS进行垂直和水平居中的主要内容,如果未能解决你的问题,请参考以下文章