gpt4 book ai didi

css - 背景图片只出现在起始页,而不会出现在其他页面

转载 作者:太空宇宙 更新时间:2023-11-04 06:14:57 25 4
gpt4 key购买 nike

我在 visual-studio 中创建了一个 Web 应用程序,并在 _Layout.cshtml 中添加了:

<style>
body {
background-image: url("Content/bground3.jpg");
background-repeat: repeat;
background-color: #00ffff;
}
</style>

由于某些原因,背景图像只出现在起始页中,而没有出现在任何子页面中,而背景色确实出现在整个页面中。

我也尝试在外部站点中放置一个图像的 url,但我得到了相同的结果。有什么想法吗?

最佳答案

我猜你的子页面有其他路径,就像你的起始页一样。

由于您在样式标签中使用了相对路径,因此目标位置会有所不同。

www.foo.bar/home.html
-> www.foo.bar/Content/bground3.jpg

www.foo.bar/subpath/subpage.html
-> www.foo.bar/subpath/Content/bground3.jpg

请在浏览器的开发者工具中检查您的网络协议(protocol),看看图像源是否真的可以获取!也许将图像源更改为绝对路径,如 /Content/bground3.jpg

关于css - 背景图片只出现在起始页,而不会出现在其他页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56068624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com