CSS3 Conversion Function transform main attribute value analysis and implementation

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.