Rule: html-attribute-values-require-quotes
Always wrap HTML attribute values in quotes, even when they are technically optional according to the HTML specification.
While some attribute values can be written without quotes if they don't contain spaces or special characters, omitting quotes makes the code harder to read, more error-prone, and inconsistent. Always quoting attribute values ensures:
- consistent appearance across all attributes,
- fewer surprises when attribute values contain special characters,
- easier editing and maintenance.
Additionally, always quoting is the common convention in most HTML formatters, linters, and developer tools.
<div id="hello"></div>
<input type="text">
<a href="/profile">Profile</a><div id=hello></div>
<input type=text>
<a href=/profile></a>