Why is it that
» valid for an alt atribute but
» is not?
It depends on your doctype. In HTML 4 and 5, using named entities like
» is perfectly valid. However, in XHTML you must use numbered entities like
» - most named entities are invalid, except for
Note: the alt tag is irrelevant in this case, it allows the same textual content as outside of HTML tags.
Simplest solution in my opinion: switch to the HTML5 doctype -
<!DOCTYPE html>. It forces standards modes in all browsers, is future proof and is dead simple to remember.