user365647
user365647

Reputation:

CSS Perspective doesn't work on body

It works if I have div wrapper:

.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

But doesn't if I apply it to the body tag:

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

Upvotes: 4

Views: 876

Answers (1)

user365647
user365647

Reputation:

Don't have a good understanding of this behaviour but the fix is to add

html {
  overflow: hidden;
}

Upvotes: 3

Related Questions