4 ms·
There are other reasons why you might not want to use data URLs, but this isn't a valid one. Which?
by abp 16y ago
There are other reasons why you might not want to use data URLs, but this isn't a valid one.
Which?
- pmjordan 16y agoFor example, you can't re-use the same image in other CSS files without duplicating the image's download cost as it's the surrounding CSS file that's cached, not the image itself. At the same time, you download all the data URL images with the CSS, regardless of whether the user ever gets to see them on the current page. Fine in some cases, not so much in others.
- jjs 16y ago> For example, you can't re-use the same image in other CSS files without duplicating the image's download cost as it's the surrounding CSS file that's cached, not the image itself. On the other hand, you could create css classes like .someImage { background: url(...) no-repeat; } and stick them in a sitewide stylesheet.
- pmjordan 16y agoThough then you may as well use a sprite atlas, as you're introducing a new HTTP request anyway.
- user24 16y agowell, yes and no; having them put away into a separate css file would be an extra http request, but it's not fair to say "therefore you might as well use sprites", because the chances are you're going to have a global stylesheet that you can tack the images onto the end of; no extra HTTP requests.
- abp 16y agoOk, thanks for thinking for me. :) On your further answers, data URLs are far better than sprites in maintainability, not(no rewriting of the map etc)? At the same time, you download all the data URL images with the CSS, regardless of whether the user ever gets to see them on the current page. Thats also true for sprites, i think.