gpt4 book ai didi

html - 外部 css 中引用的背景图像未加载

转载 作者:太空狗 更新时间:2023-10-29 14:46:13 24 4
gpt4 key购买 nike

我在外部 css 文件中有这个,但它根本不起作用。我会假设我写错了,但是当放在内部时,它工作正常。关于可能发生的事情有什么想法吗?

html
{
background-image:url(images/background-grid.jpg);
background-repeat:repeat;
}

最佳答案

我假设您的 CSS 文件位于这样的文件夹中。

    /        css/            yourcss.css        images/            background-grid.jpg        index.html

The paths given in your CSS file are relative to the path of the CSS file (in the example I given, the css folder). So you should use ..:

background-image: url(../images/background-grid.jpg);

关于html - 外部 css 中引用的背景图像未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11408980/

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