- From: 張俊芝 via GitHub <sysbot+gh@w3.org>
- Date: Mon, 06 Aug 2018 18:19:27 +0000
- To: public-css-archive@w3.org
Zhang-Junzhi has just created a new issue for https://github.com/w3c/csswg-drafts:
== preloading a CSS image ==
For now, we seem to have to do something _hacky_ if we want to preload a image for use as a CSS image later. Despite some hacky workarounds requiring script or document code invovled, there are some pure CSS wordaround(like the following example):
```
body::before
{
content: url(foo-bg.png) url(bar-bg.png) url(other-bg1.png) url(other-bg2.png);
position: absolute;
height: 0px;
width: 0px;
overflow: hidden;
z-index: -1;
}
#foo:hover
{
background: url(foo-bg.png);
...
}
...
```
It seems preloading a CSS image is "prefectly" resolved via pure CSS, however, these pure CSS methods look very counter-intuitive, lengthy and maintenance-invovling, and even further, they aren't just _theoretically garanteed_ to be correct(though they work in most of broswers in the real world).
I'd really like to see a native CSS feature that explictly provides ability to preload a image.
Any takes on this issue? I'm looking forward to hearing from you.
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2994 using your GitHub account
Received on Monday, 6 August 2018 18:29:31 UTC