No, no, yes, yes.
There is no established good practice, use the one that suits you best. There is no difference for the browser since the way to use it does not break the HTML syntax and generate unexpected results (but then the error was yours, not from the browser) and yes, you can use what you prefer.
In accordance with specification of the W3C, you can use double quotes, single quotes and even no quotes. It makes no difference.
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)
Translating by default the SGML (Standard Generalized Markup Language) requires that all attribute values are delimited by double quotes (ASCII table character 34) or single quotes (ASCII table character 39).
In Certain cases, Authors may specify the value of an attribute without any quotation Marks. The attribute value may only contain Letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation Marks Even when it is possible to eliminate them.
Translating, in certain cases authors can specify the value of an attribute with no quotation marks. In this case the attribute value may only have letters (a-za-Z), digits (0-9), hyphens, dots, underscores and two dots. The same specification even recommends avoiding this practice whenever possible - no further reason.
Then use whatever you like. It is probably always recommended to use either single or double if one day is required you do not need to correct your code.
.text-red {
color: red;
}
<div class="text-red">Com aspas duplas</div>
<div class='text-red'>Com aspas simples</div>
<div class=text-red>Sem aspas</div>
It is also mentioned that the use of both is allowed precisely to allow the use of characters in their values, as well as other languages. If you set the value with double quotes, the single quote will not break the syntax; the reciprocal is true.
But in all cases you can represent the character with your code without interfering with the HTML syntax. For example, to use double quotes in a double quote defined value you can do:
<a title="Valor do "title" com aspas duplas">Veja o title</a>
The title
anchor will be Valor do "title" com aspas duplas
whether or not it has been defined with double quotation marks.
But why the editor complained of single quotes?
It must be the editor’s internal configuration in order to maintain consistency in the project. It is more common to use double quotes and probably the editor is configured to use double quotes. When using single quotes it will emit this alert (not a error) that maybe you should reconsider your code. If double quotes are used throughout the project, why use single quotes? It is probably configurable and if you want to use single quotes, you can do it and the message will appear whenever you use double quotes.
Related: https://answall.com/q/244031/8063
– Sam