Hi, I’m learning HTML by following MDN’s Learn web development. I have a question on when to use HTML entities. If I use double quote around attribute values, is double quote the only character have to be replaced by HTML entities? so this should be correct, <
and >
is not special inside double quotes:
<meta property="og:title" content="<a>: The Anchor element">
However, I notcie https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a escapes both <
and >
:
<meta property="og:title" content="<a>: The Anchor element">
and https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started escapes only <
:
<a href="/en-US/docs/Web/HTML/Element/a"
title="The HTML <a> element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.">
where the inconsistent comes from? and what’s the best practice to use HTML entities?