我正在研究变换原点属性以及此属性的工作原理。我做了一个小型演示HERE。了解变换原点中的z偏移
HTML:
<div class="section-title">
<span data-hover="Product Range">Product Range</span>
</div>
CSS:
.section-title {
text-align: center;
margin: 50px 0px;
color: #FFF;
text-transform: uppercase;
perspective: 1000px;
}
.section-title span {
font-size: 2em;
position: relative;
display: inline-block;
padding: 0px 14px;
background: #2195DE none repeat scroll 0% 0%;
transition: transform .3s ease 0s;
transform-origin: 50% 0px 0px;
transform-style: preserve-3d;
}
.section-title span::before {
position: absolute;
top: 100%;
left: 0px;
width: 100%;
height: 100%;
background: #0965A0 none repeat scroll 0% 0%;
content: attr(data-hover);
transition: #000 .3s ease 0s;
transform: rotateX(-90deg);
transform-origin: 50% 0;
text-align: center;
}
.section-title span:hover, .section-title span:focus {
transform: rotateX(90deg) translateY(-22px);
}
.section-title span:hover::before, .section-title span:focus::before {
background: #28A2EE none repeat scroll 0% 0%;
}
现在,如果你看一下变换-origin属性它在样式表如下定义:
transform-origin: 50% 0 0;
我将它改为:
transform-origin: 50% 0;
并没有什么区别。我的问题是了解transform-origin
属性中的z轴属性值,以及没有它的情况下有什么VISUAL差异。
MDN对Z轴属性的定义如下:
Z-偏移 ::
是一个(和从来没有这将使声明 无效)描述了如何远离用户眼睛设置了z = 0原点。
尽管有这个定义,但我无法理解或重新创建任何这样的例子,其中z-偏移量造成任何视觉差异。
有人可以在这里请帮我理解在tranform-origin
中z偏移的意义是什么?有人可以提供一个关于z偏移量的视觉例子吗?