Home > Blockchain >  Hyperlink without quotes: <a href=https://example.com>...</a>
Hyperlink without quotes: <a href=https://example.com>...</a>

Time:07-02

Does this hyperlink without quotes violate the current html standard?

<a href=https://example.com>...</a>

CodePudding user response:

See the specification:

Unquoted attribute value syntax

The attribute name, followed by zero or more ASCII whitespace, followed by a single U 003D EQUALS SIGN character, followed by zero or more ASCII whitespace, followed by the attribute value, which, in addition to the requirements given above for attribute values, must not contain any literal ASCII whitespace, any U 0022 QUOTATION MARK characters ("), U 0027 APOSTROPHE characters ('), U 003D EQUALS SIGN characters (=), U 003C LESS-THAN SIGN characters (<), U 003E GREATER-THAN SIGN characters (>), or U 0060 GRAVE ACCENT characters (`), and must not be the empty string.

So it may or may not violate the standard depending on which characters are in the URL.

If you always quote your attribute values then you only need to worry about ensuring that " characters are escaped and it saves having to think about when quotes are actually required.

  •  Tags:  
  • html
  • Related