我有一个 RoR 应用程序,我正在尝试添加背景图片。在我位于 app/assets/stylesheets 的 css 文件中,我有:
html{
background-image: (destroyer.jpg);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: top;
min-height: 100;
}
但是,每次我在主页html中添加一个div时,图像似乎都被强制放在页面底部。我想要的只是整页静态背景图片。作为记录,我已经在附件中将 scroll 更改为 fixed 并且取消了最小高度,但没有成功。
请指教。
最佳答案
尝试将这些 CSS 属性添加到正文,而不是文档本身。
body {
background-image: url('destroyer.jpg');
background-repeat: no-repeat;
}
关于html - 如何放置 div "on"背景图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34775418/