首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
SAAS
ToB门户
了解全球最新的ToB事件
论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
微博
Follow
记录
Doing
博客
Blog
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
排行榜
Ranklist
相册
Album
应用中心
qidao123.com ToB IT社区-企服评测·应用市场
»
论坛
›
数据库
›
SQL-Server
›
CSS3 视差滚动相册
返回列表
发新帖
CSS3 视差滚动相册
[复制链接]
发表于 2024-8-28 00:26:59
来自手机
|
显示全部楼层
|
阅读模式
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要
登录
才可以下载或查看,没有账号?
立即注册
×
一个基于 CSS3 的视差滚动相册,采用网格布局(重要)与弹性布局。
视差滚动相册
源
代码
如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>旋转视差相册</title>
<style>
* {
margin: 0;
padding: 0;
}
.content {
width: 300px;
height: 300px;
margin: 0 auto;
margin-top: 100px;
display: grid;
/* 列 * 3,每列占 1/3,repeat的添加与否效果一致 */
/* grid-template-columns: repeat(3, 1fr);
grid-template-rows: (3, 1fr); */
/* grid-template 会覆盖前面的 grid-template-columns & grid-template-rows */
grid-template:
"A A B"
"C D B"
"C E E";
grid-gap: 10px;
padding: 10px;
border: 5px solid transparent;
border-image: linear-gradient(45deg, #df270ae0, #dc8d30, #deeb44, #01eb3e, #138fe9, #7127ee) 1;
animation: rotation 15s infinite linear;
}
.item {
overflow: hidden;
border: 1px solid #000;
display: flex;
align-items: center;
justify-content: center;
}
.item img {
animation: rotation1 15s infinite linear;
width: 300%;
height: 300%;
object-fit: cover;
}
.item:nth-child(1) {
grid-area: A;
}
.item:nth-child(2) {
grid-area: B;
}
.item:nth-child(3) {
grid-area: C;
}
.item:nth-child(4) {
grid-area: D;
}
.item:nth-child(5) {
grid-area: E;
}
@keyframes rotation {
to {
transform: rotate(360deg);
}
}
@keyframes rotation1 {
to {
transform: rotate(-360deg);
}
}
</style>
</head>
<body>
<div class="content">
<div class="item">
<img src="./static/pic1.jpg">
</div>
<div class="item">
<img src="./static/pic2.jpg">
</div>
<div class="item">
<img src="./static/pic3.jpg">
</div>
<div class="item">
<img src="./static/pic4.jpg">
</div>
<div class="item">
<img src="./static/pic5.jpg">
</div>
</div>
</body>
</html>
复制
代码
回复
使用道具
举报
返回列表
浏览过的版块
云原生
DevOps与敏捷开发
物联网
数据仓库与分析
Java
Oracle
开源技术
tsx81428
+ 我要发帖
登录后关闭弹窗
登录参与点评抽奖 加入IT实名职场社区
去登录
微信订阅号
微信服务号
微信客服(加群)
H5
小程序
快速回复
返回顶部
返回列表