Instead of changing the background image to a different URL, you should
create a single image that has them tiled together, and change the div's
background-position style to select one or the other. That guarantees you an
instant transition between the two images.

If you have several images on your page, you can combine all of them into a
single large image and use the same method to display each individual image.
This will help your page load faster.

Search for "CSS Sprites" and you'll find a lot of information on this
technique. Here's a good round-up:

http://www.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/

Of course, this won't work if you need to load just any old arbitrary URL
into your div, but if you're selecting from a specific set of images, CSS
sprites are perfect.

-Mike

On Mon, Oct 5, 2009 at 12:25 AM, Erock <ethetenniss...@gmail.com> wrote:

>
> My question is, if I have one image as the background of a div, and I
> set the background of that div to another image, will html load the
> new image before replacing the old one or replace the old image with
> something ugly (say just plain white) and then load it.
>
> The reason I'm asking is, because my site isn't hosted anywhere, it's
> hard to tell what will happen on a non-local connection when the
> images actually have to be loaded.
>
> Thanks
> Eric
>

Reply via email to