htmlcsstextcolortext-coloring

How do I make my text in HTML look like the code in here


I am trying to find a way to make my code appear as text in HTML but in the way you see the code on here

I want my code to appear like this on the website

right now when I run the code, I got it to appear as text but it looks like this:

<h1>"this is a heading"</h1>

But I want it to look like this:

<h1>"this is a heading"</h1>

basically, I'm trying to get the code that appears on my website to look like I took a screenshot of the code editor and put it on the site

If you don't understand what I'm trying to ask please ask me and I will try to elaborate further


Solution

  • quick answer will be make a div, give it a specific background color, use overflow properties to make it scrollable. Use monospace font and give specific color and background color. That'll look like a screenshot you took from code editor. but it'll be scrollable and it's necessary if you have a lot of codes.