url() function for HTML background
div { background:url(smiley.gif) top left no-repeat }
What is this url()
? I can't find documentation online.
(See http://www.w3schools.com/cssref/css3_pr_background开发者_开发问答.asp.)
In your example url
is the url of the image that will be used as the background for the div
tag.
MDN has a decent explanation of it: https://developer.mozilla.org/en/CSS/uri
MDN is usually more up-to-date than W3Schools.
It's the URL of the background image.
For example, lets say you've your images stored at /images
and you've a background image called background.png
located at /images/background.png
, then you do:
background-image: url('/images/background.png');
the background of the div will be image from file called smiley.gif you should have a file called smiley.gif at the same directory of your html file
Here is the page that mentions url: http://www.w3schools.com/cssref/pr_background-image.asp Other than that, url is simply a url string pointing to the image.
it's not HTML, yes CSS(Cascading Style Sheets).
the url ()
function set the background image for an element.
精彩评论