When i say this, i mean how do i make a specific piece of code show not as part of the actual website, but as a demonstration for others to see?
Asked
Active
Viewed 958 times
3 Answers
1
There are various ways to do so
- You may use
<pre></pre>
tag
<pre>
your-code
</pre>
- using special
<code>
tag
<pre>
<code>
your-code
</code>
</pre>
- you may like to use the HTML code within
<![CDATA[<your-code>]]>
- use any syntax highligtening library e.g. prettify or syntaxhighlighter

Swatantra Kumar
- 1,324
- 5
- 24
- 32
1
You will have to use:
- The
<pre>
- Preformatted tag to display the html text - The
<
- Less than tag in place of < tag in your code - The
>
- Greater than tag in place of > tag in your code.
i.e<div>
shall be replaced by<div>
Brief example
<pre>
<!DOCTYPE html>
<html>
<body>
<h1>The code element</h1>
<p>The HTML <code>button</code> tag defines a clickable button.</p>
<p>The CSS <code>background-color</code> property defines the background color of an element.</p>
</body>
</html>
</pre>

Lefty
- 1,192
- 13
- 18
/