CSS Perspective对身体不起作用

时间:2018-03-16 09:13:46

标签: css css3

如果我有div包装器,它可以工作:

.body {
  perspective: 1px;
  width: 100%;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  position: relative;
}

https://codepen.io/anon/pen/PRzXJe

但如果我将它应用于body标签,则不会:

body {
  perspective: 1px;
  width: 100%;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  position: relative;
  transform-style: preserve-3d;
}

https://codepen.io/anon/pen/VXjqXM

1 个答案:

答案 0 :(得分:0)

没有很好地理解这种行为,但修复是添加

html {
  overflow: hidden;
}