0

I would like to make something similar to the blue rectangle code block here: Is there any website that can help to just embed it, or it is 100% custom? Any help would be appreciated.

Armali
  • 16,557
  • 13
  • 53
  • 152
Hawyar Farooq
  • 31
  • 1
  • 1

1 Answers1

5

At a basic level you could use a textarea to show your code:

https://jsfiddle.net/qbgr17dx/

If you want to get automated styling of the code block you can use a JavaScript library such as PrismJS, this will automatically highlight syntax and code within your code blocks on your webpage:

https://prismjs.com/

You would then need to use the <code> and <pre> HTML tags, this allows your HTML to be output and shown to the user rather than the web-browser trying to show it as code/markup.

Alexander Wigmore
  • 3,067
  • 4
  • 34
  • 58