With the advent of css3, css technology has been further improved. functions previously not implemented in css2 can now be implemented, such as rounded corners, text shadows, transparency, gradient, conversion, and transition, animation. These functions are easy to use.
Today, I want to introduce the conversion usage:
Transform mainly includes the following attributes:
Rotate)
Scale)
Skew)
Translate (Object Translation)
Using the property values above, we can achieve some cool effects, such as cubes. Below is an effect I made, with three cubes of varying sizes.
The Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <meta http-equiv =" Content-Type "content =" text/html; charset = UTF-8 "/> <title> CSS3 Conversion Function </title> <script type =" text/javascript "src =" jquery-1.7.min.js "> </script> <style type =" text/css "> * {margin: 0; padding: 0; list-style: none;} body {padding-top: 100px ;}. box {margin: 0 auto 0; width: 300px; height: 500px; position: relative ;}. box. topBox {position: absolute; width: 300px; height: 150px; border: 1px solid # ccc; top: 0; left: pixel PX; background-color: yellow;-moz-transform: skew (-55deg, 0);-webkit-transform: skew (-55deg, 0);-o-transform: skew (-55deg, 0); font-size: 100px; text-align: center ;}. box. topBox02 {position: absolute; width: 300px; height: 260px; border: 1px solid # ccc; border-top: none; top: 152px; left: 0; background-color: green ;}. box. topBox03 {position: absolute; width: 214px; height: 260px; border: 1px solid # ccc; border-top: none; border-left: none; top: 76px; left: 302px; background-color: blue;-moz-transform: skew (0,-35deg);-webkit-transform: skew (0,-35deg);-o-transform: skew (0,-35deg );}. box. topBox04 {position: absolute; width: 300px; height: 150px; border: 1px solid # ccc; top: 260px; left: pixel PX;-moz-transform: skew (-55deg, 0);-webkit-transform: skew (-55deg, 0);-o-transform: skew (-55deg, 0 );}. box02 {-moz-transform: scale (0.5, 0.5) translate (455px,-838px);-webkit-transform: scale (0.5, 0.5) translate (455px,-838px ); -o-transform: scale (0.5, 0.5) translate (455px,-838px );}. box03 {-moz-transform: scale (0.2, 0.2) translate (1671px,-4354px);-webkit-transform: scale (0.2, 0.2) translate (1671px,-4354px ); -o-transform: scale (0.2, 0.2) translate (1671px,-4354px );}. box. topBox05 {position: absolute; width: 300px; height: 260px; border-left: 1px solid # ccc; top: 0; left: 214px ;} </style>
Tip: the code can be modified before running!