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

Re: How to preload background image

From: Darren Ferguson <darren@crystalballinc.com>
Date: Mon, 19 Nov 2001 22:11:08 -0500 (EST)
To: "V.I.X" <vixcc@yahoo.com>
cc: Tantek Celik <tantek@cs.stanford.edu>, Cristiano Guglielmetti <guglielmetti@tin.it>, www-style@w3.org
Message-ID: <Pine.LNX.4.10.10111192210080.6240-100000@thread.crystalballinc.com>


Darren Ferguson
Software Engineer
Openband

On Mon, 19 Nov 2001, V.I.X wrote:

> What about using Javascript?
> 
> backg = new Image();
> backg.src = "../images/bkgdbase.gif";
> 
> Putting these in a script at the beginning of the document will ask the browser to start
> downloading them first.
> 
> Later on, when the "background" attribute is referenced, the image will appear automatically.

The piece below will not cause a problem if you specify the
parameters/dimensions of the table.


> 
> Furthermore, putting the body text and graphics in a table will delay its appearance until the
> whole table is read in. I don't know if this helps you but it applies to some cases.
> 
> Best regards,
> 
> Vix!
> 
> --- Tantek Celik <tantek@cs.stanford.edu> wrote:
> > 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
> > 
> 
> 
> =====
> --------------------------------------------
> "People are of three types: those who know 
> how to count, and those who don't..."
> tAke a bReak! gEt eNtertained!!!
> @ http://sallini.com/
> ----------------
> 
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
> 
Received on Monday, 19 November 2001 20:53:52 GMT

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