gpt4 book ai didi

css - 如何在 contentscriptfile 中使用相对 url?

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

它在 firefox 附加 sdk 文档中说 page-modcontentStyleFile 选项 here那:

In earlier versions of this module, you couldn't use relative URLs in stylesheets loaded in this way, and you had to use a workaround. In current versions this has been fixed, and the workaround is no longer needed.

但是它没有提到如何做到这一点,我试图在我的插件中包含 data 文件夹中的本地镜像:

element
{
background: url(data/image.jpeg);
}

但是什么也没发生..

如何在不使用 javascript 的情况下在我的 contentStyleFile 中引用图像 url?

最佳答案

contentScriptFile 中的 URL 是相对于 contentScriptFile 本身的。

在我的示例中,contentScriptFile (style.css) 位于 data 文件夹中,因此要引用图像 image.jpeg 所有我必须做的是:

element
{
background: url(image.jpeg)
}

关于css - 如何在 contentscriptfile 中使用相对 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26793125/

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