W3C home > Mailing lists > Public > www-style@w3.org > November 2001

Re: How to preload background image

From: Tantek Celik <tantek@cs.stanford.edu>
Date: Sun, 18 Nov 2001 12:52:29 -0800
To: Cristiano Guglielmetti <guglielmetti@tin.it>, www-style@w3.org
Message-id: <0GN000I2FKHD8B@mta5.snfc21.pbi.net>
From: "Cristiano Guglielmetti" <guglielmetti@tin.it>
Subject: How to preload background image
Date: Sat, Nov 17, 2001, 11:39 AM

> Using:
>
> body
> {
>  margin: 0;
>  background-image: url('../images/bkgdbase.gif');
>  background-color: #ffffff;
>  font-family: Verdana, Arial;
>  font-size: 8pt;
>  color: #336699
> }
>
> the background image is loaded by the client at the same time of the text
> and others images.
>
> Is there a method to pre-load background image as first and then other
> objects?

A similar topic recently came up in a HTML working group meeting.

> I found some improvements removing "background-image" from CSS and putting
> <body background="image"> in the html.

Actually, leaving both in should be fine.

Optimally, this concept of "pre-load" would just be another LinkType[1],
e.g. it would be nice if putting this in the <head> worked:

<link rel="preload" href="../images/bkgdbase.gif" />

One way to get a background image (or other stylistic image) loading very
soon after the document starts loading is to reference it from an image tag
in the document which is then hidden using CSS, e.g.

...
<body>
 <p style="display:none">
  <img src="../images/bkgdbase.gif" />
 </p>
...


Tantek

[1]
 http://www.w3.org/TR/html401/types.html#h-6.12
Received on Sunday, 18 November 2001 15:49:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:11 GMT