Pre-Loading Images

后端 未结 5 616
悲&欢浪女
悲&欢浪女 2021-01-01 01:03

Is there a way to pre-load images just using html/css?

相关标签:
5条回答
  • 2021-01-01 01:33

    Yes: http://perishablepress.com/press/2008/04/15/pure-css-better-image-preloading-without-javascript/

    0 讨论(0)
  • 2021-01-01 01:36

    Yes you can. There are many tutorials available on this topic - here is one of them.

    0 讨论(0)
  • 2021-01-01 01:36

    Or even easier: <link rel="prefetch" href="path to image"> (Firefox).

    <link rel="prerender" href="http://example.org/index.html"> (Chrome)

    0 讨论(0)
  • 2021-01-01 01:41

    If you include an url in your CSS, the image will be downloaded as the .css file is loaded into the document.

    0 讨论(0)
  • 2021-01-01 01:45

    Yes, there is. There's a technique called CSS sprites.

    It basically works by loading one big image and then only displaying certain sections of the image as needed. Obviously, this technique isn't practical for every solution but it's good for many.

    A List Apart has a great tutorial on this: A List Apart: Articles: CSS Sprites: Image Slicing's Kiss of Death

    0 讨论(0)
提交回复
热议问题