html - CSS视差效果与背景图像比例?
问题描述
我希望在滚动上创建视差效果 - 但背景图像在滚动时会增加/缩放。
这是我到目前为止的代码:
.parallax {
/* The image used */
background-image: url("img_parallax.jpg");
/* Set a specific height */
min-height: 500px;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
有没有办法可以将效果添加到 CSS 规则?
非常感谢,
解决方案
推荐阅读
- jquery - 如何在 mvc jquery modal 中查看 base64 字符串的内容
- sql-server - 从SQL中的多个表中级联删除行
- sql - 如何修复错误“引用表的给定键没有唯一约束匹配”
- python - 如何使用python获取字典列表中的特定键值
- reactjs - FramerMotion 在动画上置换项目
- csv - 导入到 PSPP 后损坏的 .csv 数据
- g++ - local-prefix 包含目录和 GCC-prefix 包含目录有什么区别?
- swift - 如何在 Swift 中划分命名空间?
- php - 传值时不跳转到其他页面
- reactjs - 在 Typescript 中使用带有 MUI DatePicker 组件的 React Hook 表单