Click to See Complete Forum and Search --> : How To Make HTML Code Appear As Text?


donaldt1989
12-04-2006, 08:16 AM
I just have a simple question if you all don't mind. How do I make html code appear as normal text instead the code inserting its self. I Remember there was some tag you put before you code so it doesn't execute. If anyone can help me out I'd greatly appreciate it.

LeeU
12-04-2006, 08:47 AM
<code>HTML code here won't execute.</code>

Also, if you are putting a "<" in there, use &lt; to keep it from executing.

Charles
12-04-2006, 11:48 AM
<code>HTML code here won't execute.</code>You're thinking of a different, non-standard element. The CODE element is no different than several others and properly can contain any inline element.From the HTML 4.01 DTD
<!ENTITY % phrase "EM | STRONG | DFN | CODE |
SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*>
<!ATTLIST (%fontstyle;|%phrase;)
%attrs; -- %coreattrs, %i18n, %events --
>
http://www.w3.org/TR/html401/struct/text.html#edef-CODE

donaldt1989
12-04-2006, 03:29 PM
Thank you very much both of you!

HTML God
12-10-2006, 09:52 AM
Ok, i'll use an example. If you wanted people to see the text not the code, simply put <xmp> and </xmp> at the end of it, so it should look like this.
Say I wanted to use bold.

<xmp><STRONG>blahblahblah</STRONG></xmp>

and now people looking will see the text, not the active code. That should solve your problem.

Charles
12-10-2006, 10:45 AM
XAMP is the Microsoft extension of HTML to which I referred above. But being non-standard it should not be expected to work on any other browsers or even all versions of MSIE.