() div.
transform-origin:center bottom; for the test2 transform-origin: center top; for test3. , 50%.- , test1, div , , test2.
test1:
.container
{
perspective:600px;
transform-style: preserve-3d;
}
.test2
{
background-color: #fff;
border: 1px solid #ccc;
position: relative;
width: 50%;
padding: 1em;
margin: auto;
transform: rotateX(45deg);
transform-origin: center bottom;
outline: 1px solid transparent;
}
.test3
{
background-color: #fff;
border: 1px solid #ccc;
position: relative;
max-width: 50%;
padding: 1em;
margin: auto;
transform: rotate3d(1,0,0,-45deg);
transform-origin: center top;
}
<body>
<div class="container">
<div class="test2">test2
<p>hello</p>
<p>hello</p>
<p>hello</p>
<p>hello</p>
</div>
<div class="test3">test3</div>
</div>
</body>
Hide resulttest1: ( )
.container
{
perspective:600px;
transform-style: preserve-3d;
}
.test1
{
background-color: #fff;
border: 1px solid #ccc;
width: 50%;
padding: 1em;
margin: auto;
}
.test2
{
background-color: #fff;
border: 1px solid #ccc;
position: relative;
width: 50%;
padding: 1em;
margin: auto;
transform: rotateX(45deg);
transform-origin: center bottom;
outline: 1px solid transparent;
}
.test3
{
background-color: #fff;
border: 1px solid #ccc;
position: relative;
max-width: 50%;
padding: 1em;
margin: auto;
transform: rotate3d(1,0,0,-45deg);
transform-origin: center top;
}
<body>
<div class="container">
<div class="test1">test1</div>
<div class="test2">test2
<p>hello</p>
<p>hello</p>
<p>hello</p>
<p>hello</p>
</div>
<div class="test3">test3</div>
</div>
</body>
Hide resultuser7207170