简体   繁体   中英

How to write html entity code into an HTML file as they are?

I'm tring to write a code to show html entites as they are like this

© => & copy;

Now here if i don't add a space b/w '&' and 'copy;' it will show as the copyright symbol which i don't want.

 <body> <p>This is <br> &copy; => &copy; </p> <pre> <code> &copy; </code> </pre> </body> 

You can show a & sign using &amp;

So &amp;copy; would render &copy; as text

Put '&' or 'copy' in a span tag.

 <body> <p>This is <br> &copy; => &<span>copy<span>; </p> <pre> <code> &copy; </code> </pre> </body> 

To do this, you have to use the entity for the & symbol. For &copy; , you would have to type:

$amp;copy;

This will return: &copy; (this is written as it is)

Just use an entity for the ampersand.

 <p>This is <br> &amp;copy; => &copy; </p> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM