Helle friend's, how can i make a juck of html code within an html document to be rendered as text.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Helle friend's, how can i make a juck of html code within an html document to be rendered as text....

I am writing a blog, so I want to give an HTML example, but I want the HTML example to be rendered as pure text, not to be included with the other HTML code... https://code.sololearn.com/Wulk2Rgp1xZF/?ref=app

28th Jun 2022, 12:56 PM
🤖Web Gig🤖
🤖Web Gig🤖 - avatar
6 Answers
+ 6
Use &lt; and &gt; instead of < and > respectively. A lot more to write, but it works! Correct me if there is any other way
28th Jun 2022, 1:02 PM
Xemonix
Xemonix - avatar
+ 4
You can try <pre> tag or there is lot of js library for hilighting codes in web view like highlight.js , prism.js etc.... You can try one of them for better appearance 😉 🙏 🙃👍
28th Jun 2022, 2:03 PM
ㅤ Tweetu 😆 ㅤㅤ
ㅤ  Tweetu 😆 ㅤㅤ - avatar
28th Jun 2022, 2:47 PM
🤖Web Gig🤖
🤖Web Gig🤖 - avatar
28th Jun 2022, 1:04 PM
🤖Web Gig🤖
🤖Web Gig🤖 - avatar
+ 2
Maybe with a little Javascript? ('<a_tag>Content</a_tag>').replace(/</g, '&lt;').replace(/>/g, '&gt;');
28th Jun 2022, 1:55 PM
Steve
Steve - avatar
+ 1
wrap it in a pre tag, it will preserve it or code tag
30th Jun 2022, 6:28 AM
✳AsterisK✳
✳AsterisK✳ - avatar