IE6 PNG Transparency CSS background-repeat Fix

Couple of people around the forums and here commented that none of the current Internet Explorer 6 PNG scripts provide fix for the issue of using png image as CSS repeated background (background-repeat: repeat/repeat-x/repeat-y).

Therefor with no generic solution at this time I thought of three possible workarounds:

  1. Use sizingMethod=’scale’
  2. Use flash for rendering the png
  3. Make as much as needed areas and repeat with Javascript

Here I will explain the first one since it was the easiest to try.

The idea is very simple just use filter: progid: DXImageTransform.Microsoft.AlphaImageLoader(enabled=’true’, sizingMethod=’scale’, src=’the-image-you-want-to-repeat.png’ ) and make sure you properly apply the other CSS rules. This technique uses scaling instead of repeating but for shadows and other cool effects it is sufficient.

End result and demo following:

Preview for IE6 PNG background-repeat

For more info see the demo under Internet Explorer 6

Optimizing Page Load Time – Caching

I was always keen on speed improvements and something that might be worth sharing are couple of techniques for improving caching efficiency and effect.

Lets review what happens when a user tries to load a web page:

1. The user’s browser sends request for the HTML (I’m skipping the part with dns lookups, three way handshaking etc)

2. While HTML is being parsed additional request are done for all other contents – CSS, Javascript, Images, etc.

3. When the browser requests some file (image for example) it first checks in the browser cache with two possibilities:

3.1 File is not in the cache, so there is another HTTP GET Reques sent to the server

3.2 File is in the cache – here starts the tricky part.

OK we have the file in the cache but the browser needs to check if there is newer version of this file and therefore sends Conditional Request to the server asking if the content has changed. Luckily sometimes the file is not changed (understood from the timestamp) and the server answers 304 (not modified) so we have saved bandwidth but not HTTP request.

The bad news is that nowadays bandwidth savings usually are less important than requests count!
For getting out of this uncomfortable situation there are HTTP Expires Headers – generally they define for how long a cached object is fresh and can be served directly from the cache without additional modification checks.

The tip for today: Add HTTP Expires Headers to all objects that you don’t change often, this way except from bandwidth you will save and couple otherwise expensive HTTP Requests.

Update: Another interesting thing that I stumbled upon is Contextual Precaching – generally when clicking on the search input on Yahoo’s homepage they start preloading images for the search result page – pretty neat huh?