The <url>
CSS data type denotes a pointer to a resource. It has no proper syntax and can only be expressed through the url()
functional notation.
url()
functional notation was introduced to describe... URL, i.e. locations (a <url>
CSS data type, though it wasn't explicitly defined that way).url()
was used to create a <uri>
CSS data type. Not only was this confusing, but URN are almost never used in the CSS usual case.url()
denotes a <url>
CSS data type and no more the more generic <uri>
CSS data type.Many CSS properties take a URL as value, such as background-image
, cursor
, @font-face
, list-style
etc.
The URL may be unquoted, or quoted by single or double quotes. Relative URLs are allowed and are relative to the URL of the stylesheet (not to the URL of the web page).
<a_css_property>: url("http://mysite.example.com/mycursor.png") <a_css_property>: url(http://mysite.example.com/mycursor.png)
Note: Control characters above 0x7e are no longer allowed in unquoted url() notation starting in Firefox 15. See bug 752230 for more details.
.topbanner { background: url("topbanner.png") #00D no-repeat fixed; }
ul { list-style: square url(http://www.example.com/redball.png) }
Specification | Status | Comment |
---|---|---|
CSS Values and Units Module Level 3 The definition of '<url>' in that specification. | Candidate Recommendation | No significant change from CSS Level 2 (Revision 1) |
CSS Level 2 (Revision 1) The definition of '<uri>' in that specification. | Recommendation | No significant change from CSS Level 1 |
CSS Level 1 The definition of '<url>' in that specification. | Recommendation |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.0) | 3.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (3.5) | yes | yes | 1.0 |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/uri