0
Are the quotation marks ("") after the href attribute necessary?
my code worked with out them!
2 ответов
+ 9
Yes! It's necessary but not compulsory. It's a good practice to always put quotation around attribute value.
+ 4
The use of unquotted attributes values is supported since earlier versions of Html ( 2.0, the first standardized specification )...
However, in XHtml branch based on XML, quotes are required. But this branch was now abandonned, and Html5 still considers these as optionnal, even if you need them in some case: space is the separator char used for attributes in tag, as well as for multiple values in attribute, so you cannot avoid quotes AND have multiple values attributes:
<div class="foo bar">
... is totally different of:
<div class=foo bar>
The second one is even invalid, because 'bar' isn't a valid Html attribute ^^
Anyway: use of them is a good practice, but laziness push on not used them :P