?
This document uses PHP Chinese website manual Release
perspective-origin:[ <percentage> | <length> | left | center① | right ] [ <percentage> | <length> | top | center② | bottom ]?
默認(rèn)值:50% 50%,效果等同于center center
適用于:變換元素
繼承性:無(wú)
動(dòng)畫(huà)性:當(dāng)值為數(shù)值時(shí)
計(jì)算值:除了指定絕對(duì)值,否則都為百分比
媒體:視覺(jué)
<percentage>:用百分比指定透視點(diǎn)坐標(biāo)值,相對(duì)于元素寬度??梢詾樨?fù)值。
<length>:用長(zhǎng)度值指定透視點(diǎn)坐標(biāo)值??梢詾樨?fù)值。
left:指定透視點(diǎn)的橫坐標(biāo)為left
center①:指定透視點(diǎn)的橫坐標(biāo)為center
right:指定透視點(diǎn)的橫坐標(biāo)為right
top:指定透視點(diǎn)的縱坐標(biāo)為top
center②:指定透視點(diǎn)的縱坐標(biāo)為center
bottom:指定透視點(diǎn)的縱坐標(biāo)為bottom
該屬性提供2個(gè)參數(shù)值。
如果提供兩個(gè),第一個(gè)用于橫坐標(biāo),第二個(gè)用于縱坐標(biāo)。
如果只提供一個(gè),該值將用于橫坐標(biāo);縱坐標(biāo)將默認(rèn)為center。
對(duì)應(yīng)的腳本特性為perspactiveOrigin。
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 6.0-9.0 | 2.0-9.0 | 4.0-11.0 | 6.0-8.0-webkit- | 15.0-22.0-webkit- | 6.0-8.4-webkit- | 2.1-2.3 | 18.0-34.0-webkit- |
10.0-11.0-ms- | 10.0-15.0-moz- | 12.0-35.0-webkit- | 9.0+ | 23.0+ | 9.0+ | 3.0-4.4.4-webkit- | 35.0+ | |
Edge | 16.0+ | 36.0+ | 40.0+ |
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>perspective-origin_CSS參考手冊(cè)_web前端開(kāi)發(fā)參考手冊(cè)系列</title> <meta name="author" content="Joy Du(飄零霧雨), dooyoe@gmail.com" /> <meta name="copyright" content="www.doyoe.com" /> <style> .wrapper { display: inline-block; width: 200px; height: 200px; margin: 10px; border: 1px solid #000; -webkit-perspective: 150px; perspective: 150px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .w1 { -webkit-perspective-origin: top; perspective-origin: top; } .w2 { -webkit-perspective-origin: bottom; perspective-origin: bottom; } .wrapper > div { width: 180px; height: 120px; margin: 40px 10px; background-color: #ccc; -webkit-transform: rotatex(90deg); transform: rotatex(90deg); } </style> </head> <body> <div class="wrapper w1"> <div>1</div> </div> <div class="wrapper w2"> <div>2</div> </div> </body> </html>
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例