Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use CSS3 to make 3D translucent cube

Shulou Source: shulou.com Published: 2022-05-31 13:04:17 09月26日 Update

This article mainly explains "how to use CSS3 to make 3D translucent cube". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use CSS3 to make 3D translucent cube".

The effect picture is as follows:

Sample code:

New document / / css part html {font-size:62.5%;} img {width:300px; height:300px;} # stage {/ / build a stage margin-top:200px; margin-left:auto; margin-right:auto; width:300px; height:300px; perspective:1200px; font-size:5em Font-weight:bold; color:#cc00ff;} .cube {/ / cube is a cube position:relative; transform:rotateX (- 45deg) rotateY (45deg); transform-style:preserve-3d; transition: all .6s;} .side {color:blue; text-align:center; width:300px; height:300px; line-height:300px; position:absolute Background:#cc66ff; opacity:0.5; border:1px solid rgba (117 transform:translateZ 4);} / .front to .bottom are 6 faces rotated separately to construct the shaping of cube. Front {transform:translateZ (150px);} .back {transform:rotateY (180deg) translateZ (150px) } .left {transform:rotateY (- 90deg) translateZ (150px);} .right {transform:rotateY (90deg) translateZ (150px);} .top {transform:rotateX (90deg) translateZ (150px);} .bottom {transform:rotatex (- 90deg) translateZ (150px) } # stage:hover .cube {/ / set whether the transition effect is required when the mouse moves over the cube, and the time and speed at which the transition effect starts and ends transform:rotateX (- 45deg) rotateY (225deg); transition:transform .6s;}

Thank you for your reading, the above is the content of "how to use CSS3 to make 3D translucent cube". After the study of this article, I believe you have a deeper understanding of how to use CSS3 to make 3D translucent cube, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Cubes production effects cubes cubes learning content code that is ideas situations rendering articles time more knowledge knowledge points examples articles stage Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information Linux vpn OPPO Reno