博客园美化,旋转立方体
可自行调整位置,并替换图片,示例代码如下:
<!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>
<div class="wrap">
<div class="cube">
<div class="out_front"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube01.bmp" class="pic"/></div>
<div class="out_back"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube02.bmp" class="pic"/></div>
<div class="out_left"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube03.bmp" class="pic"/></div>
<div class="out_right"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube04.bmp" class="pic"/></div>
<div class="out_top"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube05.bmp" class="pic"/></div>
<div class="out_bottom"><img src="https://files-cdn.cnblogs.com/files/cjsblog/cube06.bmp" class="pic"/></div>
</div>
</div>
</body>
</html>
博客设置
将CSS代码粘贴到“页面定制CSS代码”区域,将 div 放到 “博客侧边栏公告”区域
标签:cube,translateZ,博客园,transform,60px,rotateY,立方体,美化,out From: https://www.cnblogs.com/cjsblog/p/16851231.html