Question: Are quotes required around HTML 5 attributes?
In XHTML, all attribute values must be quoted using double quote marks.
Answer:
When writing HTML 5 attributes, you do not need to use quotation marks to define the value. When you don't use quotation marks you cannot use the following characters in your attribute values:
- double and single quote marks (" and ')
- spaces ( )
- equal sign (=)
- greater-than sign (>)
In order to use those characters with unquoted attribute values you must either escape them using HTML codes or you must quote your attribute values.
Examples of Correct and Incorrect HTML 5 Attributes
Incorrect HTML 5 attributes:
<p class=blah blah>
<p class=blah=blah>
<p class=blah>blah>
<p class=blah'blah>
<p class=blah"blah>
Correct HTML 5 attributes:
<p class=blahblah>
<p class="blah blah">
<p class=blah=blah>
<p class=blah>blah>
<p class="blah'blah">
<p class='blah"blah'>

