How can I display html code in webpage?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I display html code in webpage??

29th Mar 2020, 5:05 PM
Himanshu Rai
Himanshu Rai - avatar
2 Answers
+ 2
code : &lt; span &gt; displays this: <span> &lt; is less than. &gt; is greater than. If it's long code you can also embed it from gist : https://gist.github.com/ Note : Don't write question in tags.
29th Mar 2020, 5:08 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
By using <code>your HTML code</code> tag. But before that, you need to usescape your HTML code(convert < and > to it's character entity code i.e. &lt; and &gt; respectively. For that you can use any HTML usescape online tool. This is a good and better online HTML escape unescape tool: https://codebeautify.org/html-escape-unescape example this on your source code: <code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Hello&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code> will display this on your webpage.: <!DOCTYPE html> <html> <head> </head> <body> <p>Hello</p> </body> </html>
29th Mar 2020, 5:12 PM
Bibek Oli
Bibek Oli - avatar