Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在CSS';s url()?_Css - Fatal编程技术网

是否可以在CSS';s url()?

是否可以在CSS';s url()?,css,Css,我想为外部网站编写一个用户(即我的机器本地)CSS规则,以将本地文件添加到我的机器作为背景,即不从Web服务器添加。例如,站点有一个h1标签和两个p标签 我尝试了以下方法: p { background: url('/home/andrybak/1.png') repeat; } h1 { background: url('file:///home/andrybak/1.png') repeat; } 这两个选项在Firefox和Chrome中都不起作用。CSS的url()支持

我想为外部网站编写一个用户(即我的机器本地)CSS规则,以将本地文件添加到我的机器作为背景,即不从Web服务器添加。例如,站点有一个
h1
标签和两个
p
标签

我尝试了以下方法:

p {
    background: url('/home/andrybak/1.png') repeat;
}
h1 {
    background: url('file:///home/andrybak/1.png') repeat;
}
这两个选项在Firefox和Chrome中都不起作用。CSS的
url()
支持吗?

CSS的
url()
只支持url,不一定支持URI。
file://
URI方案定义了一个URI,而不是URL。主要区别在于,虽然URI只标识资源,但URL指定了资源在internet上的位置


来源:

@长崎谢谢你!