代码拿来就能用,只需要将图片替换为自己的就可以,和html同级别即可
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.content {
width: 1000px;
height: 500px;
margin: 0 auto;
border-radius: 30px;
/* background-image: url('./bgImg.jpg'); */
position: relative;
}
.content div {
width: 400px;
height: 300px;
position: absolute;
left: 300px;
top: 100px;
transform-style: preserve-3d;
animation: rotate 12s linear infinite;
}
.content div a {
display: block;
width: 400px;
height: 300px;
position: absolute;
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotateY(360deg);
}
}
.content div a:nth-child(1) {
background-image: url('./bg2.jpg');
background-size: cover;
transform: translateZ(270px);
}
.content div a:nth-child(2) {
background-image: url('./bg3.jpg');
background-size: cover;
transform: translateX(270px) rotateY(90deg);
}
.content div a:nth-child(3) {
background-image: url('./bg4.jpg');
background-size: cover;
transform: translateZ(-270px);
}
.content div a:nth-child(4) {
background-image: url('./bg.jpg');
background-size: cover;
transform: translatex(-270px) rotateY(-90deg);
}
</style>
</head>
<body>
<div class="content">
<div>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
<a href="#"></a>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
img {
width: 450px;
height: 250px;
overflow: left;
}
#container {
width: 450px;
height: 250px;
overflow: hidden;
margin: 50px auto;
}
#picture {
width: 1800px;
height: 250px;
animation: switch 8s linear infinite;
}
#picture:hover {
animation-play-state: paused;
opacity: 0.5;
}
#picture:li:hover {
opacity: 1;
}
#picture li {
float: left;
list-style-type: none
}
@keyframes switch {
0%,
10% {
margin-left: 0;
}
30%,
40% {
margin-left: -450px;
}
60%,
70% {
margin-left: -900px;
}
90%,
100% {
margin-left: -1350px;
}
}
</style>
</head>
<body>
<div id="container">
<ul id="picture">
<li><img src="./bg2.jpg" width="1920" height="1080" /></li>
<li><img src="./bg3.jpg" width="1920" height="1080" /></li>
<li><img src="./bg4.jpg" width="1920" height="1080" /></li>
<li><img src="./bg5.jpg" width="1920" height="1080" /></li>
</ul>
</body>
</html>
原文地址:https://blog.csdn.net/z1093541823/article/details/124382592
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_39718.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。