CSS3 2D ??
CSS3 ??
CSS3 ??? ?? ??? ??, ?? ??, ??, ???? ?? ? ????.
???? ??
IE10, FireFox ? Opera? ?? ??? ?????. Chrome ? Safari?? ??? -webkit-? ?????.
??: IE9?? ??? -ms-? ?????.
2D ??
? ???? 2D ??? ?? ?????. ???:
translate()
rotate()
scale()
skew()
matrix()
translate() ???
??? ??? ??(x ??) ? ??(y ??) ?? ????? ?? ?? ???? ?????. :
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(php.cn)</title> <style type="text/css"> /*translate方法位移*/ div { width:100px; height:80px; background-color:orange; position:absolute; left:100px; top:100px; } div.one { transform:translate(30px,30px); z-index:1; } div.two { background-color:blue; } </style> </head> <body> <div class="one"></div> <div class="two"></div> </body> </html>
rotate() ???
??? ??? ??? ?? ??? ?? ?? ?? ???? ??? ?? ?????? ???? ???.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(php.cn)</title> <style type="text/css"> div { width: 150px; height: 50px; background-color: orange; text-align: center; position: absolute; left: 100px; top: 100px; } div.one { transform: rotate(30deg); -webkit-transform:rotate(30deg); } div.two { background-color: blue; color: white; } </style> </head> <body> <div class="one"></div> <div class="two"></div> </body> </html>
scale() ???
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(php.cn)</title> <style type="text/css"> div{ width: 100px; height: 100px; background-color: orange; position: absolute; left: 100px; height: 100px; } div.one { background-color: red; transform: scale(0.5,0.5); } </style> </head> <body> <div> <div class="one"></div> </div> </body> </html>
skew() ???
skew() ???? ???? ??? ???(X?) ? ???(Y?) ????? ?? ??? ??? ??? ??????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(php.cn)</title> <style type="text/css"> div{ width:100px; height:100px; background-color:orange; position:absolute; left:100px; top:100px; } div.one { background-color:red; transform:skew(30deg,10deg); } </style> </head> <body> <div></div> <div class="one"></div> </body> </html>
Matrix() ???
matrix() ???? ?? 2D ?? ???? ?????.
matrix() ???? 6?? ????? ???? ?? ??, ?? ??, ?? ? ????? ??? ? ?? ?? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(php.cn)</title> <style type="text/css"> div{ width:100px; height:100px; background-color:orange; position:absolute; left:100px; top:100px; } div.one { transform:matrix(0.866,0.5,-0.5,0.866,0,0); background-color:red; } </style> </head> <body> <div></div> <div class="one"></div> </body> </html>
? ?? ??
?? ?? ??? ??? ????.
?? ?? ??????????????????????????????????????
transform 2D ?? 3D ?? ??? ?? 3 ??>
??????????????????????????????????????????????????|translate(x,y) X ? Y?? ?? ??? ???? 2D ??? ?????.
translateX(n) X?? ?? ??? ???? 2D ??? ?????.
translateY(n) Y?? ?? ??? ???? 2D ??? ?????.
scale(x,y) ??? ??? ??? ???? 2D ???? ??? ?????. scaleX(n) ??? ??? ???? 2D ?? ?? ??? ?????.
scaleY(n) ??? ??? ???? 2D ???? ??? ?????.