In CSS you declare a background-image by wrapping it inside a url('') ... is there an example when you don't need do this and if not why does it even exist? Even when you're using base64 you still wrap it in a url and I can't seem to find a reasoning for why this is the case. You don't wrap background colour around additional information so why is this the case for a background image.
Asked
Active
Viewed 106 times
1 Answers
3
You can assign different values, not just "url" but also "none", "inherit" and "initial". URL is the function that is used to identify resource and an image is a resource, hence the URL function is used. Using a function also allows you to specify multiple arguments easily and do escaping, which can be handled by the function.
Background-color actually accepts different values and follows the same pattern: there are values such as "none", actual colors such as "black", RGB-codes such as #00FF00 or the RGB-function (which is similar to url): rgb(255, 0, 255)

JDT
- 6,360
-
See now you've said that it makes complete sense! Thanks! – Kevin S Jul 28 '15 at 12:28