Forum Moderators: open

Message Too Old, No Replies

< /> not &lt; / a&gt;

using special characters?

         

mossimo

11:50 pm on Jul 1, 2003 (gmt 0)

10+ Year Member



I need to create about 50 popup windows containing instructions on html coding that will involve displaying code in its original look not rendered as html.

I know to make "<>" appear on screen I can use "&lt;a&gt;"

But wow what a pain. Anyone know of a simple way to tell the browser to render straight text and not render it as code?

Thanks All :)

lorax

12:55 am on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hm...

Re: pain - ya - but it is the proper way to do it.

You could put them in without conversion then use a search and replace to change them over to thier proper html formats.

mossimo

1:11 am on Jul 2, 2003 (gmt 0)

10+ Year Member



I din't think of that, bulk search and replace could be very effective. Still a pain thought...

MWpro

3:41 am on Jul 2, 2003 (gmt 0)

10+ Year Member



I had to do this before and I used the find and replace method as well.

If you don't want to do it like that, I think a textarea would work too.

Pete_Dizzle

11:16 pm on Jul 4, 2003 (gmt 0)

10+ Year Member



I believe there is a tag
<XMP></XMP>

just put your code between that and it should work.

ShawnR

11:34 pm on Jul 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another proper way to do it is to put the code in a <textarea>. e.g.
<textarea rows="3" cols="80">hello <b>hello</b></textarea>

Shawn

[Added: Oops; sorry I see that has already been suggested]

kapow

12:17 pm on Jul 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you use DreamWeaver you can paste the code into the page (not into the code inspector) and it will convert all the characters for you.

mossimo

1:10 pm on Jul 5, 2003 (gmt 0)

10+ Year Member



<XMP></XMP> is a text attribute only for use in fixed width fonts.

<textarea> Works well if you don't mind that text box look.

If you use DreamWeaver

Yes kapow I do use dreamweaver and your right that does work well.

It's just too bad there’s no simple little tag to serve the same purpose.

Nick_W

1:44 pm on Jul 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With CSS you could change the appearance of the textarea to resemble the normal page. Pretty easy for modern browsers and who cares otherwise, they'll just get the normal textarea look and no harm done ;)

Also, if your server runs PHP you could run your html through the htmlspecialchars() [dk2.php.net] function.

Nick

mincklerstraat

2:18 pm on Jul 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HTML-Kit (chamisplace.com) is a great editor that does all kinds of nifty stuff, and a function for converting < and > is one of them. It's free for non-commercial use, too.

mossimo

1:52 am on Jul 12, 2003 (gmt 0)

10+ Year Member



Hay Nick_W I tried the PHP
htmlspecialchars() function
works great thanks.

But I am not aware of any CSS functions that could make the <textarea> borders or scroler disapear.

Let me know
Thanks

DrDoc

2:05 am on Jul 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS functions that could make the <textarea> borders or scroler disapear

textarea {
border: none;
overflow: hidden;
}

mossimo

4:32 am on Jul 12, 2003 (gmt 0)

10+ Year Member



Learn somthing new every day.

Thanks DrDoc

g1smd

8:19 pm on Jul 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




You should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:

<link type="text/css" rel="stylesheet" src="/path/file.css">

It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:

<meta http-equiv="Content-Style-Type" content="text/css">

<style type="text/css">
@import url(path/file.css);
</style>

This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.