Skip to content

24 ways to impress your friends

Vote down?

Lachlan Hunt

I don’t think the error icon should have necessarily been included as an image in the in the markup, as the specific graphic is still somewhat dependant upon the site’s design. However, there probably should have been some additional (alternate) content that is removed with CSS when the icon is available.

For that, I’ve often used something like this: (I’ve used square brackets instead of angle brackets, because this broken comment form provides no way for me to include them, since all HTML tags and even entity references are stripped instead of converted sensibly.)

[p class="error"][strong class="desc"]Error[/strong] Your postal/zip code was not in the correct format.[/p]

Then I hide the strong element and add the background image.