Sunday, 24 August 2008

HTML IMG Tag - Default Image

To set "default image" in <img> you need to create javascript onerror event. onerror is triggered when an image cannot be displayed for whatever reason:

<img src="http://www.domain.com/image.jpg" onerror="this.src='/error.gif'" />

Easy.

Sunday, 3 August 2008

Remove that dotted border using CSS

Sometimes, when I click on someone’s logo, I see that little dotted border around the image. Personally, I think it looks a bit messy (why would you want to highlight the image when you click on it?):


There is a very easy CSS trick to remove that little border:

a { outline: none; }

Now, you try and see :)