CSS Transform-style properties for 3D effects

Source: Internet
Author: User

Rendered in 2d plane relative to Transform-style:flat, transform-style:preserve-3d renders all child elements in 3d space.

Instance:

Html:

1 <Divclass= "Transform-style">2     <H3>Put the mouse on the picture to see the effect Oh! (Picture inversion 360 degrees)</H3>3     <Divclass= "Container">4         <Divclass= "inner">5             <Divclass= "Rotate">6                 <imgsrc= "Http://images2015.cnblogs.com/blog/561794/201604/561794-20160412230412973-1641353956.jpg"alt=""width= "142"Height= "$" />7             </Div>8         </Div>9     </Div>Ten  One     <H3>Put the mouse on the picture to see the effect Oh! (Image inversion 360 degrees-using transform-style:preserve-3d; effect)</H3> A     <Divclass= "Container"> -         <Divclass= "inner"> -             <Divclass= "Rotate three-d"> the                 <imgsrc= "Http://images2015.cnblogs.com/blog/561794/201604/561794-20160412230412973-1641353956.jpg"alt=""width= "142"Height= "$" /> -             </Div> -         </Div> -     </Div> +     </Div>
View Code

Css:

1 . Transform-style. Container{2 width:500px;3 Height:300px;4 margin:10px Auto;5 position:relative;6}7 . Transform-style. Inner{8 width:142px;9 Height:200px;Ten position:Absolute; One} A //Set animation - @keyframes Inner{ - 0%{ the Transform:Rotatey (0deg) -} - 100%{ - Transform:Rotatey (360deg) +} -     } + //Call animation A . Transform-style. Inner:hover{ at Animation:Inner 5s linear infinite; -} -  - . Transform-style. Rotate{ - background:URL ("http://images2015.cnblogs.com/blog/561794/201604/561794-20160412230412973-1641353956.jpg") no-repeat Center; - Border:5px Solid Hsla (50,50%,50%,.9); in Transform:Perspective (200px) Rotatey (45deg); -} to . Transform-style. Rotate img{ + Border:1px solid Green; - Transform:Rotatex (15deg) Translatez (10px); the Transform-origin:0 0 40px; *} $ //Change the default value of Transform-stylePanax Notoginseng . Transform-style. three-d{ - Transform-style:preserve-3d; the}
View Code

View Demo Online

CSS Transform-style properties for 3D effects

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.