Click to See Complete Forum and Search --> : Html code?


Goonie
05-12-2003, 12:34 AM
What HTML code do i use to show code on a webpage?

Any examples out there that i can see?

Bullschmidt
05-12-2003, 01:12 AM
My favorite is to simply change the less than character which is the first part of every tag to be < instead.

nkaisare
05-12-2003, 08:47 AM
Originally posted by Dave Clark
You may be able to use the <PRE></PRE> tags for this, too.
You still need &quot; &lt; and &gt; for ", < and > respectively, don't you?

Bullschmidt
05-12-2003, 01:59 PM
&lt; seems to be enough for me, and I do like to keep things simple.

But no, I don't believe you'd need this if you used the <pre> and </pre> tags, but then you might lose some formating of how things look.

nkaisare
05-12-2003, 02:17 PM
Two examples I tried:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>

<body>
<pre><b>This is some bold text</b>.</pre>
<p>As you can see, you need to enclose the text you need to be made bold within
&lt;b&gt; and &lt;/b&gt;. This is preferred way of making text visually
bold-faced. If this text has to be emphasized, use &lt;strong&gt; and
&lt;/strong&gt; instead. Semantically, this means that this text is
&quot;spoken&quot; more strongly than rest of the paragraph. Visually, both
&lt;b&gt; and &lt;strong&gt; may look the same.</p>
</body>
</html>

In the second example, I used

<pre>&lt;b&gt;This is some bold text&lt;/b&gt;.</pre>

No brainer that the latter worked. Former just made the PREformatted text boldface.