Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would HTML code be added to a webpage?

Tags:

html

How would one add HTML code snippets into an HTML file without them being rendered as elements on the webpage?

While this could be achieved using images, I'd prefer to have a 'code window with syntax highlighting' like the one pictured below taken from css-tricks.com;

Screenshot of an HTML code snippet, from css-tricks.com

like image 958
ravindUwU Avatar asked Jul 18 '26 12:07

ravindUwU


1 Answers

To be able to write html snippets onto an html web page you need to switch opening and closing tags < > with &lt; and &gt;

And to give it syntax highlighting you can use googles own prettify script found Here

like image 141
Novocaine Avatar answered Jul 20 '26 03:07

Novocaine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!