Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Display HTML hyperlink code as pure text? (http://www.velocityreviews.com/forums/t369948-display-html-hyperlink-code-as-pure-text.html)

Michael Jones 09-11-2006 09:23 PM

Display HTML hyperlink code as pure text?
 
I would like to display some HTML hyperlink code as pure text on a web page
(ie I would like the user to be able to read the code).

I have tried to wrap the code in <code> tags but this does not seem to
work.

TIA



Beauregard T. Shagnasty 09-11-2006 09:55 PM

Re: Display HTML hyperlink code as pure text?
 
Michael Jones wrote:

> I would like to display some HTML hyperlink code as pure text on a web
> page (ie I would like the user to be able to read the code).
>
> I have tried to wrap the code in <code> tags but this does not seem
> to work.


Convert all of the < to &lt;
and the > to &gt;

--
-bts
-Motorcycles defy gravity; cars just suck.

David Dorward 09-11-2006 09:55 PM

Re: Display HTML hyperlink code as pure text?
 
Michael Jones wrote:

> I would like to display some HTML hyperlink code as pure text on a web
> page (ie I would like the user to be able to read the code).


http://allmyfaqs.net/faq.pl?Show_HTML_examples

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

mbstevens 09-11-2006 10:03 PM

Re: Display HTML hyperlink code as pure text?
 
On Mon, 11 Sep 2006 21:23:45 +0000, Michael Jones wrote:

> I would like to display some HTML hyperlink code as pure text on a web
> page (ie I would like the user to be able to read the code).
>
> I have tried to wrap the code in <code> tags but this does not seem to
> work.



Use '&lt;' for '<' and '&gt;' for '>'.
That way, tags won't actually be interpreted as tags by the
visitor's browser. If you notice anything else in the code
not behaving in the way you expect, just use a character entity
or numeric entity instead of the character itself. If you google for
those two things you'll get more information.
--
mbstevens
http://www.mbstevens.com



Michael Jones 09-11-2006 10:17 PM

Re: Display HTML hyperlink code as pure text?
 

"mbstevens" <NOXwebmasterX@XmbstevensX.com> wrote in message
news:pan.2006.09.11.22.05.13.210685@XmbstevensX.co m...
> On Mon, 11 Sep 2006 21:23:45 +0000, Michael Jones wrote:
>
>> I would like to display some HTML hyperlink code as pure text on a web
>> page (ie I would like the user to be able to read the code).
>>
>> I have tried to wrap the code in <code> tags but this does not seem to
>> work.

>
>
> Use '&lt;' for '<' and '&gt;' for '>'.
> That way, tags won't actually be interpreted as tags by the
> visitor's browser. If you notice anything else in the code
> not behaving in the way you expect, just use a character entity
> or numeric entity instead of the character itself. If you google for
> those two things you'll get more information.
> --
> mbstevens
> http://www.mbstevens.com
>
>

To all the respondents:

Your solution worked perfectly - Thanks!

Michael Jones



Chris F.A. Johnson 09-11-2006 10:25 PM

Re: Display HTML hyperlink code as pure text?
 
On 2006-09-11, Michael Jones wrote:
> I would like to display some HTML hyperlink code as pure text on a web page
> (ie I would like the user to be able to read the code).
>
> I have tried to wrap the code in <code> tags but this does not seem to
> work.


Either rename the file (or a copy of it) with a .txt instead of
.html extension (you can use a link on a Unix system), or change
all instances of '<' to '&lt;' and '&' to '&amp;'.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Toby Inkster 09-12-2006 05:05 AM

Re: Display HTML hyperlink code as pure text?
 
Beauregard T. Shagnasty wrote:
> Michael Jones wrote:
>
>> I have tried to wrap the code in <code> tags but this does not seem
>> to work.

>
> Convert all of the < to &lt;
> and the > to &gt;


You should probably still keep the <code>...</code> tags though -- as this
lets browsers know that you're displaying some source code. They can then
choose an appropriate way of displaying it -- often in a fixed-width font,
but perhaps in an audio browser, read by a different voice, or on systems
with only one font, in a different colour.

<code>&lt;A HREF="http://www.google.co.uk/"&gt;Google&lt;/A&gt;</code>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


Jukka K. Korpela 09-12-2006 06:07 AM

Re: Display HTML hyperlink code as pure text?
 
Toby Inkster <usenet200608@tobyinkster.co.uk> scripsit:

> You should probably still keep the <code>...</code> tags though -- as
> this lets browsers know that you're displaying some source code.


Besides, if the page is submitted to automatic translation, then the
translation engine _may_ treat <code> markup as indicating content that
should remain invariant in translation. Some engines do.

> <code>&lt;A HREF="http://www.google.co.uk/"&gt;Google&lt;/A&gt;</code>


Some people would say that these days, one should not use uppercase letters
in element and attribute names, since they are disallowed in XHTML.

The use of &gt; for > is merely a common practice for symmetry. There is no
need to "escape" > in HTML. The days when some browsers got this wrong have
gone long ago.

Anyway, as I have often replied in response to the oft-repeated question
"how do I show HTML code on my page", I'd like to tell the OP that if he had
to ask, he's probably not qualified to give others advice on using HTML
markup on his pages.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



All times are GMT. The time now is 07:14 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.