i didn’t knew this. are you sure about this?
If your connection is slow enough, you’ll see the delay here as you hover over each smaller image, a whole new image (so not a sprite) is loaded in the middle. Faster connections may not see the delay.
did you mean small BG images may load and display before larger foreground images complete loading?
The browser starts in order of the HTML from top to bottom. Assuming the browser is internet exploder, there can only be two persistent connections at a time. So here’s how it goes, if I understand it correctly:
…assuming head, css already passed through…
<body>
<div>
<img src=“foo.jpg” width=“400” height=“600” alt=“”> <–let’s call this a large 300kb jpg
<p>some content…</p>
<img src=“bar.gif” width=“4” height=“10” alt=“”> <– a small 356byte gif
</div>
<div>
<h1>Title</h1>
<p>some content…</p>
<img src=“semi-trans.png” width=“90” height=“90” alt=“”> <–a 6kb png
<p>m0ar c0wbell!</p>
</div>
<div>
<img src=“foot.png” width=“10000” height=“20” alt=“”> <–another large jpg
</div>
</body>
</html>
As the browser goes from top to bottom, it meets a call for foo.jpg. It asks the server for foo.jpg. The server putzes around for a bit and after admitting it does have such a file and the browser is allowed to have it, it starts sending foo.jpg.
The browser continues through the page, rendering content until it sees bar.gif. It stops, asks the server for bar.gif, the server checks and replies that yes, it has bar.gif and yes, the browser can haz bar.gif, and the second connection is used to get bar.gif. foo.jpg is large and still loading. However bar.gif is small and within a short amount of time, bar.gif is in. Browser continues through the HTML until it sees semi-trans.png.
Asks the server if it can haz, server checks, server says yes I haz, and yes you can haz, browser uses second connection to start loading semi-trans.png.
In the meantime foo.jpg finally finishes loading. The browser now has a connection it can use… it’s still loading semi-trans.png but continues through the page until it sees foot.png. Asks the server. Server checks. Server says I haz, server says you can haz, browser starts loading foot.png while finishing up semi-trans.png.
So the smaller file (bar.gif) got loaded before the jpg, but this is because being smaller means it got entirely loaded faster and freed up a connection for something else faster.
I dunno how it goes with images called by CSS. I don’t know the order between HTML images vs CSS images once both HTML and CSS are still being read.