Skip to content

24 ways to impress your friends

Vote down?

Derek Featherstone

@seb frost: to answer both of your questions…

“why the extraneous div around the p – this seems like wasted markup to me, i tend to just use class=”error” on my p tag and apply all the styling needed directly to that.”

Sure – but often I’ll use a div with class of error and then I can place whatever content I want in there and I’m not limited to one paragraph.

“I also prepend “Error: ” at the start of the error message. I like having that text visible even to normal users, and obviously it will work fine for screen readers and the like.”

That’s another possibility, to be certain. However, do you also inlude an icon or other visual representation of status/state that shows an error had occurred? Or are you relying simply on “text” to convey all of your message?

“I’d much rather that than put a needless (IMHO) image tag every time I have an error/message/warning etc on a page.”

Why is it needless? Do you not believe that images can convey information quickly and effectively? (I’m not asking this sarcastically – I’m geniunely interested in the answer)