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.
Asked
Active
Viewed 3,473 times
1

Armali
- 18,255
- 14
- 57
- 171

Hawyar Farooq
- 41
- 2
- 2
-
2possible duplicate as: https://stackoverflow.com/questions/4611591/code-vs-pre-vs-samp-for-inline-and-block-code-snippets – Julian Silvestri Jan 29 '19 at 19:26
1 Answers
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:
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,157
- 4
- 38
- 60