html - 图片滑动背景内容

标签 html css

我正在尝试让我的网站类似于 http://allfiredupinc.com/所以当你向下滑动时它不显示背景,然后显示内容。此外,当您向上滚动时,它会显示背景。

http://i.stack.imgur.com/2CIsh.png

body {
        background: url("http://uploadir.com/u/j027zo9j") no-repeat top center fixed;
        background-size: cover; 
}

我怎样才能添加这样的内容?它显示的漂亮的小效果?

最佳答案

margin-top 添加到您的内容容器,因此如果您的内容容器有一个 ID #main-content,您可以为其指定以下样式:

#main-content {
    /* Adjust this value as you want */
    margin-top: 30em;
    /* Other properties */
    ...
}

关于html - 图片滑动背景内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29584948/

相关文章:

javascript - 滚动到一个链接并激活它

html - pre 标签中的 AngularJS 数据绑定(bind)

javascript - 设置div为背景

css - IE7 中内联跨度的奇怪换行

html - 输入字段不必要的属性正在接受 IOS 设备

html - Bootstrap 导航栏中的神秘填充

HTML/CSS : Navigation bar stretches to fit, 容纳变量 html

css - 有没有办法不用注册就可以用disqus接收评论通知?

css - 防止 Bootstrap 4 自动填充列换行到下一行

html - css div居中