URI values are expressed with a functional notation that, for historical reasons, is named url.1 A URI is expressed using the following syntax: url(URI). For example, here’s a background-image declaration that specifies the URI of an image file:

#example {
  background-image: url(images/bg.gif);

The argument for URI is a string that may be enclosed in quotes; if you choose to use quotes, they may be double or single quotes.2 Certain characters appearing in an unquoted URI value—whitespace characters, single and double quotes, parentheses, and commas—must be escaped with a backslash. In some types of URIs, you can also replace these characters with URI escape sequences; for example, you can use %20 to replace a space character.

Tip: Relative URIs

Relative URIs are relative to the style sheet, not to the HTML document that links to the style sheet.


1 In the beginning, web addresses were called Uniform Resource Locators (URL). Later, something called Uniform Resource Name (URN) was added. A Uniform Resource Identifier (URI) is a URL or a URN.

2 Some browsers, like Internet Explorer 5 for Mac, don’t support single quotes in url(URI) syntax.

User-contributed notes

Related Products