博客园美化,旋转立方体
可自行调整位置,并替换图片,示例代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>立方体效果</title>
<style type="text/css">
.wrap {
width: 120px;
height: 200px;
margin: 20px;
position: fixed;
top: 200px;
right: 600px;
display: table-cell;
vertical-align: middle;
text-align: center;
z-index: 22;
}
.cube {
width: 120px;
height: 120px;
margin: 0 auto;
transform-style: preserve-3d;
transform: rotateX(-30deg) rotateY(-80deg);
animation: rotate linear 20s infinite;
}
@-webkit-keyframes rotate {
from {
transform: rotateX(0deg) rotateY(0deg);
}
to {
transform: rotateX(360deg) rotateY(360deg);
}
}
.cube div {
position: absolute;
width: 120px;
height: 120px;
opacity: 0.8;
transition: all .4s;
}
.cube .out_front {
transform: rotateY(0deg) translateZ(60px);
}
.cube .out_back {
transform: translateZ(-60px) rotateY(180deg);
}
.cube .out_left {
transform: rotateY(-90deg) translateZ(60px);
}
.cube .out_right {
transform: rotateY(90deg) translateZ(60px);
}
.cube .out_top {
transform: rotateX(90deg) translateZ(60px);
}
.cube .out_bottom {
transform: rotateX(-90deg) translateZ(60px);
}
</style>
</head>
<body>
</body>
</html>
博客设置
将CSS代码粘贴到”页面定制CSS代码”区域,将 div 放到 “博客侧边栏公告”区域
Original: https://www.cnblogs.com/cjsblog/p/16851231.html
Author: 废物大师兄
Title: 博客园美化——旋转立方体效果
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/711511/
转载文章受原作者版权保护。转载请注明原作者出处!