Search code examples
htmlescaping

What does 'HTML is escaping' mean?


Why is HTML is escaping = HTML is showing as it is?

Example: If I try to put any HTML tag here, it will not show that tag (it will simply work). What is it? Escaping or not escaping?


Solution

  • Escaping in HTML means, that you are replacing some special characters with others. In HTML it means usually you replace e.g. < or > or " or &. These characters have special meanings in HTML.

    Imagine, you write

    <b>Hello, World!</b>
    

    And the text will appear as Hello, World!. But sometime you don't want to have this behaviour. So you replace the < and >.

    &lt;b&gt;Hello, World!&lt;/b&gt;
    

    This will result in <b>Hello, World!</b>.