Simplicity
Simplicity

Reputation: 48946

HTML element for inserting source code styled text

What is the HTML element that one can use in order to insert source code styled text in the page display?

Thanks.

Upvotes: 0

Views: 358

Answers (2)

jstanley
jstanley

Reputation: 814

<tt>text</tt> will give you a fixed-width font. Wrapping this inside <pre></pre> will make formatting be preserved. For example, <pre><tt>code here</tt></pre>. You will still need to use html codes for characters such as < and > (&lt; and &gt; respectively).

Upvotes: 1

Brett Walker
Brett Walker

Reputation: 3586

Am I missing something? The tags < code > or < pre > might serve you purpose.

Upvotes: 2

Related Questions