CSS: What does the question mark at the end of css do?
Example from Wikipedia css:
#content a[href^="https://"], .link-https {
background:url("images/external-link-ltr-icon.png?2") no-repeat scroll right center transparent;
padding:0 13px 开发者_JAVA百科0 0;
}
That's actually not part of CSS itself, but rather, part of the querystring to the image.
It's the same as:
http://foo/images/external.png?bar=baz
The site will take that querystring parameter and value as part of the request. It could make a decision on which file to serve, based on the value supplied.
Likely it's a version number. It helps get around the situations where your browser may have cached the image.
This is (usually) used to invalidate the cached version of the image..
When ever you make a new version of the image, you change the number forcing browsers to reload and not use the cached version..
Not part of CSS, but rather the browser behaviour..
It's probably a so-called cache-buster. It works by the server setting a far future cache expiry date and every time the designer changes that image he can increment the number in the stylesheet and the image will be reloaded.
There's no question mark there except for the one in the URL. That one works just like in any HTTP url; the stuff after it is a query string, to be interpreted however the script that responds to the request chooses to interpret it.
In the case of a static image, this is a technique often used to defeat caching. The number's a bit too small to suggest that, though. The query-string part might be used to denote the version of the image, so that caches don't return an image that'd no longer work with the layout. That's just a guess, though.
Like everyone said, it's part of the URL. The purpose is cache-busting. When the image changes, so does the parameter, so clients will get the latest version.
This is not a CSS feature, it's a feature of URLs; the question-mark denotes the start of the query string.
The question mark isn't part of the CSS, it's used to request a non-cached version of the image.
精彩评论