這篇文章主要為大家展示了“css中的perspective-origin屬性怎么用”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“css中的perspective-origin屬性怎么用”這篇文章吧。
CSS3perspective-origin屬性
作用:perspective-origin屬性定義3D元素所基于的X軸和Y軸。該屬性允許您改變3D元素的底部位置。當為元素定義perspective-origin屬性時,其子元素會獲得透視效果,而不是元素本身。
語法:
perspective-origin:x-axisy-axis;
x-axis:定義該視圖在x軸上的位置。默認值:50%??赡艿闹担簂eftcenterrightlength%
y-axis:定義該視圖在y軸上的位置。默認值:50%??赡艿闹担簍opcenterbottomlength%
注:該屬性必須與perspective屬性一同使用,而且只影響3D轉換元素。
CSS3perspective-origin屬性的使用示例
<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8">
<style>
#div1
{
position:relative;
height:150px;
width:150px;
margin:50px;
padding:10px;
border:1pxsolidblack;
perspective:150;
perspective-origin:10%10%;
-webkit-perspective:150;/*SafariandChrome*/
-webkit-perspective-origin:10%10%;/*SafariandChrome*/
}
#div2
{
padding:50px;
position:absolute;
border:1pxsolidblack;
background-color:red;
transform:rotateX(45deg);
-webkit-transform:rotateX(45deg);/*SafariandChrome*/
}
</style>
</head>
<body>
<divid="div1">
<divid="div2">HELLO</div>
</div>
</body>
</html>
以上是“css中的perspective-origin屬性怎么用”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。