0

I want to write a user (i.e. local to my machine) CSS rule for an external website to add a file local to my machine as background, i.e. not from a webserver. Site https://example.org, which has one h1 tag and two p tags is used as an example.

I tried the following:

p {
    background: url('/home/andrybak/1.png') repeat;
}
h1 {
    background: url('file:///home/andrybak/1.png') repeat;
}

Both options do not work in Firefox and in Chrome. Does CSS's url() support file URI scheme?

andrybak
  • 2,129
  • 2
  • 20
  • 40

1 Answers1

1

CSS's url() only supports URLs, not necessarily URIs. The file:// URI scheme defines a URI, not a URL. The main difference is that while a URI only identifies a resource, a URL specifies the location of a resource on the internet.

Source: https://drafts.csswg.org/css-values-3/#urls

spicy.dll
  • 948
  • 8
  • 23