Demo
源码地址
https://github.com/b3log/index/tree/master/src/main/webapp/sym
原理
使用 background-attachment 属性设置背景图像是否固定或者随着页面的其余部分滚动
html 结构
css
.bg { position: relative; width: 100%; height: 600px; background-attachment: fixed; background-position: center center; background-repeat: no-repeat; background-size: cover; background-image: url(images/bg2.jpg); }
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于