HTML properties without quotation marks?

后端 未结 5 895
走了就别回头了
走了就别回头了 2020-12-11 04:08

I\'ve always thought html requires quotation marks in his properties:

or
5条回答
  •  一向
    一向 (楼主)
    2020-12-11 04:29

    You can omit the quotes from an attribute value if the value consists of the following characters only (cf to the technical concept of name):

    letters of the English alphabet (A to Z, a to z)
    digits (0 to 9)
    periods .
    hyphens -
    

    Thus, WIDTH=80 and ALIGN=CENTER are legal shorthands for WIDTH="80" and ALIGN="CENTER". A reference to a URL like HREF=foo.html is acceptable, but in general URLs must be quoted when used in attributes, e.g. HREF="http://www.hut.fi/". - Some browsers are more permissive. Some browsers may even accept elements with a starting quote but without any closing quote. Such use is very bad practise.

    refer http://www.cs.tut.fi/~jkorpela/HTML3.2/3.4.html

提交回复
热议问题