Skip to content

24 ways to impress your friends

Vote down?

Seb Frost

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.

Fair enough, I find that’s a rarity so use a p normally and extra elements as and when needed.

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 also use an icon as a background image on the p.

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)

Not denying that at all, that’s why I do have an image in the background of the p tag. But I like the cleanness and compactness of the source code with no image tags cluttering it up.

Putting the image declaration in the stylesheet makes it:

1) easier to change site-wide

2) smaller source files (CSS file is cached so preferable to put the code in there)

I can see the argument you’re making, and don’t totally disagree with you – the second example you give is more along my lines of thinking: carry on using the background image, and add actual real text (not alt text) to convey the meaning as clearly as possible regardless of how the user is browsing the page.