CSS url() Function
Example
.example1 {
background: url(flowers.jpg);
}
.example2 {
background: url("flowers.jpg");
}
.example3 {
background: url('flowers.jpg');
}
Meaning
The url() css function specifies the parameter is an absolute URL, a relative URL, a blob URL, or a data URL.
Quotes are required if the URL includes parentheses, whitespace, or quotes, unless these characters are escaped, or if the address includes control characters above 0x7e. Double quotes cannot occur inside double quotes and single quotes cannot occur inside single quotes unless escaped.
The url() function can be passed as a parameter of another CSS functions, like the attr() function. Depending on the property for which it is a value, the resource sought can be an image, font, or a stylesheet.
The url() function can be included as a value for: background, background-image, border, border-image, border-image-source, content, cursor, filter, list-style, list-style-image, mask, mask-image, offset-path @font-face, and @counter-style
Version: CSS3
Standard Syntax
url(string)
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Function Arguments
The following table describes the arguments of this function.
Argument | Description |
---|---|
string | Specifies a URL or the ID of an SVG shape.
|