Is it acceptable to use single quotes around html attribute values like this:
<span class='classname'>Hi</span>
Instead of double quotes like this:
<span class="classname">Hi</span>
Who defines what's okay? W3C?
Yes, that's acceptable. It works in browsers, and it's allowed by the specifications.
The HTML5 spec says:
In the HTML syntax, attributes can be specified in four different ways:
- empty attribute syntax
- unquoted attribute-value syntax
- single-quoted attribute-value syntax
- double-quoted attribute-value syntax
The HTML4 spec says:
By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With