HTML and CSS Reference
In-Depth Information
The URL function ( <url> ) is used to designate the address of a resource
for use in a property such as background-image or list-style-image .
The path of the resource follows the same rules as other uniform
resource identifier (URI) usages like link href values in HTML. When using
external style sheet documents, relative paths relate to the document
the CSS rule is found in (the external CSS document) and not the source
HTML document.
body { background-image: url(../images/bg_body.png); }
body { background-image: url(/images/bg_body.png); }
body { background-image: url(
bg_body.png); }
URIs can be quoted with single or double quotes or can be left unquoted.
For historical reasons dating back to IE for the Mac, single quotes are
sometimes avoided as a best practice.
data: URIs
The data: URI scheme uses encoded strings to represent file data
inline rather than as a path to an external file. This can be quite use-
ful for small resources such as iconography, list bullets, or font faces
because it cuts down the number of requests to the server or for
mobile applications.
You can find support for this URI scheme in CSS in Internet Explorer
8+, Firefox, Safari, and Opera. The source code for data: URIs can be
easily generated with “The data: URI kitchen” tool by Ian Hickson
( ).
Search WWH ::

Custom Search