这篇文章给大家分享的是有关CSS3怎么制作三维相册效果的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
XML/HTML Code复制内容到剪贴板
<!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>三维动画</title>
<style type="text/css">
* {
padding : 0px;
margin: 0px;
}
body {
background: url(images/758.jpg) no-repeat top center;
}
.product {
height: 400px;
position: fixed;
top: 20%;
right: 20%;
/*视距*/
perspective : 500px;
}
.scene {
height: 250px;
width: 250px;
transform-style: preserve-3d;
transform-origin: 50%;
margin: 100px;
/*定义一个名为slide的动画*/
animation: slide 12s linear infinite;
}
.scene ul li {
width: 230px;
height: 230px;
list-style: none;
border: 5px solid rgba(255, 255, 255, 0.5);
position: absolute;
}
@keyframes slide{
from{
transform: rotateY(0deg);
}
to{
transform: rotateY(360deg);
}
}
.s1 {
float: left;
}
.s1 ul li:nth-child(1) {
transform: rotateY(0deg) translateZ(118px);
}
.s1 ul li:nth-child(2) {
transform: rotateY(90deg) translateZ(118px);
}
.s1 ul li:nth-child(3) {
transform: rotateY(180deg) translateZ(118px);
}
.s1 ul li:nth-child(4) {
transform: rotateY(-90deg) translateZ(118px);
}
.s2 {
float: right;
}
.s2 ul li:nth-child(1) {
transform: rotateY(0deg) translateZ(200px);
}
.s2 ul li:nth-child(2) {
transform: rotateY(90deg) translateZ(200px);
}
.s2 ul li:nth-child(3) {
transform: rotateY(180deg) translateZ(200px);
}
.s2 ul li:nth-child(4) {
transform: rotateY(-90deg) translateZ(200px);
}
</style>
</head>
<body>
<div class='product'>
<!-- scene类是为了修饰两个div的相同点 -->
<!-- s1和s2是为了显示两个div的不同,一个左浮动,一个右浮动 -->
<div class='scene s1'>
<ul>
<li><img src="images/1.jpg"/></li>
<li><img src="images/2.jpg"/></li>
<li><img src="images/3.jpg"/></li>
<li><img src="images/4.jpg"/></li>
</ul>
</div>
<div class='scene s2'>
<ul>
<li><img src="images/1.jpg"/></li>
<li><img src="images/2.jpg"/></li>
<li><img src="images/3.jpg"/></li>
<li><img src="images/4.jpg"/></li>
</ul>
</div>
</div>
</body>
</html>
下面是截图:
感谢各位的阅读!关于“CSS3怎么制作三维相册效果”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://www.jb51.net/css/473805.html