Languages
[Edit]
EN

HTML - ampersand escape code

10 points
Created by:
Elias999
369

In this short article, we would like to show how to escape ampersand characters in HTML source code.

Escaping ampersand characters in HTML source code.
Escaping ampersand characters in HTML source code.

Quick solution:

Replace &  with the & in the HTML source code.

 

Practical example

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <p>This text contains &amp; characters.</p>
</body>
</html>

SCREENSHOT (in React / Preact / HTML it is necessary to escape ampersands same way):

When VS Code marks ampersand as error - escape required.
When VS Code marks ampersand on red as error - escape required.

See also

  1. HTML - characters that should be escaped
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join