An attribute specification consists of the following, in this order:
is always safe to enclose the attribute value
in quotes, using either single quotes ('80') or
double quotes ("80"), using matching quotes of course.
The string in quotes must not contain the quote, so if the data
contains a double quote, use single quotes for quoting, and
vice versa. Some browsers do not treat quotes within quotes
correctly, so if you need to include a quote as data character
into an attribute value, it is probably safest to present
them using character escapes:
double quote " as
single quote ' as
In general, using double quotes is preferable, since for the human eye single quotes are sometimes difficult to distinguish from other characters like accents. Moreover, some browsers do not handle single quotes correctly.
You can also omit the quotes from an attribute value if the value consists of the following characters only (cf to the technical concept of name):
Often an attribute value is keyword-like: it must be one of a set of particular strings (case-sensitively and allowing quotes around). For example, if a P element contains an ALIGN attribute, its value must be one of LEFT, CENTER, RIGHT. There are also attributes for which a string in general can be used as value; technically speaking, such attributes are declared as having CDATA value in the formal SGML description (DTD) for HTML. Even within such attribute values, no HTML tags are recognized. On the other hand, escape sequences are recognized and interpreted within attribute values. (At least they should. Some browsers don't get this right.) This in turn means that if any of the characters &<> is to appear within an attribute value, it is safest to present it using the escape notation & or < or > respectively.
There is a minimized syntax for attributes when the attribute value is the same as the attribute name. For instance, <UL COMPACT="COMPACT"> can be abbreviated as <UL COMPACT> (and it is common practise to do so). Some browsers even require minization for some attributes (COMPACT, ISMAP, CHECKED, NOWRAP, NOSHADE, NOHREF), so perhaps it is best to use the minimized syntax when applicable.