我有一张图片:app/assets/images/oops.jpg
在 404.html 我有:
<html>
<head>
<title>Oops! Where are we?</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background: url('oops.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
我确认图像确实在 Heroku 上生产,但浏览器找不到图像。
这是我的文件的图像。
我在这里错过了什么?
最佳答案
如果你的图片是app/assets/images/oops.jpg
然后你的图像路径需要是:
body {
background: url('/app/assets/images/oops.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
关于html - 404 图像未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39861671/