Forum Moderators: open

Message Too Old, No Replies

Basic HTML Question - Please help clarify

Attributes - MUST they be withing quotation marks?

         

martinibuster

4:01 pm on Oct 1, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Thanks,
Just trying to clarify this with someone else.

Knowles

4:13 pm on Oct 1, 2002 (gmt 0)

10+ Year Member



I think to validate they have to be, as long as its HTML and not XHTML I think you can get away with not doing it. I would say its best to go ahead and do it.

marek

4:22 pm on Oct 1, 2002 (gmt 0)

10+ Year Member



In HTML the attrubute values need not be quoted, provided they do not contain whitespaces. In XHTML all attrubute values have to be quoted. It's a good idea to quote all attribute values even in HTML because of forward compatibility.

g1smd

5:22 pm on Oct 1, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In HTML 4.01, when using 0 to 9 and A to Z only, they don't have to be quoted, but W3C recommends that they all are.

In XHTML they must be always quoted.

In any HTML version, if the string includes any other characters than 0 to 9 and A to Z, it must also be quoted e.g. color="#FF00FF"

If there is any white space in the attribute it must be quoted.

martinibuster

6:30 pm on Oct 1, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Good answers, thanks.

Although there's probably no way to say so definitively, I think that it may not be too unreasonable to think having no-quote attribues may contribute to a spider incorrectly understanding what's on the page.

Or am I being paranoid?