Languages
[Edit]
EN

HTML - ampersand escape code

10 points
Created by:
Elias999
759

In this short article, we would like to show how to escape 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

Alternative titles

  1. HTML - ampersand in HTML code
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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