+ 1
How do we write a programing code as text to your web page?
4 Answers
+ 2
As suggest put your programming code within <code> </code> tags. You may use <pre>..</pre> tags to retain whitespace such as spaces, tabs and returns keys.
+ 2
<code> is the tag semantically adapted, but for styling, you may want to reproduce behaviour of <pre> tag ( which keep spaces, line-breaks and don't arbitrary break lines ), as well as escape special Html characters ( at least '<' and '&' by respectively '<' and '&' ), or a code like:
<code><test>test</test></code>
... will not be outputed as expected ( the <test> tags disappears ;) )
So I suggest to write ( inlined css only for providing example ):
<code style="white-space:pre"><test>test</test></code>
Wich means some preprocessing.
Also if you want have syntaxic colour, you must preprocess you code to style it: some library can be found to help you ^^
+ 1
Do you want to link to a web page?
+ 1
If its in another language use code tags <code>code here</code>