Forum Moderators: open
I remembered coming across this and making a mental note, now I need to use it.
I want to display some HTML code on a page. I thought the tag <code> would do this. I then tried the <pre> tag. The code contains a hyperlink and all the page shows when saved is the text for the hyperlink.
Confused,
Brian
Thanks for the quick answers. Each only show the end result hyperlink when viewed.
I ended up using <P> tags. I then cut and pasted the HTML code into normal view within FP. It now shows the code correct when viewing but here is the difference...
Code that is needed to be shown...
<p><a href="callto:nssrc3ntwkstn+secure=true">nssrc3ntwkstn</a></p>
Displays OK but looking at the source it embedded it like this...
<p><font SIZE="1" COLOR="#0000c0"><p><a href=</font><font SIZE="1">"callto:nssrc3ntwkstn+secure=true"</font><font SIZE="1" COLOR="#0000c0">></font><font SIZE="1">nssrc3ntwkstn</font><font SIZE="1" COLOR="#0000c0"></a></p></font></p>
Oh well, they only see wht appears on the page. I just strees on code bloat, guess I shouldn't in this case and jsut move on.
Edit: Pageoneresults, I tried textarea, it does work, gives a nifty scroll box to boot :).
Brian
Edit: Pageoneresults, I tried textarea, it does work, gives a nifty scroll box to boot.
I see this method used quite frequently when visiting sites that offer scripts. I think its the best way to present a cut and paste option to users. If they try cutting and pasting from within a <p> tag that has inline styles, they end up with all of that code. They need text which the textarea offers.
(edited by: toadhall at 8:03 pm (utc) on Mar. 11, 2002)
I tried textarea, it does work, gives a nifty scroll box to boot
Yes, for the most part. There are, however a few problems with wrapping.
But before you worry about this, be sure to make the scrollbox display properly in NN 4. You'll need to do the following:
On the other hand, Netscape 6 will wrap at spaces,etc., but not in the middle of a word, producing a horizontal scrollbar instead.
So, you have to try to find a suitable width for your textbox combined with well-placed spaces to prevent unwanted breaks or scrollbars.
Anyone know another solution to the wrapping problems?
If FP means front page and you don't like code bloat. Well, you're an oxymoron ;-)
I don't see the wrapping problem someone mentioned... If you set wrap="virtual" then there is no actual wrap (just a visual one). Copied and pasted text will show up in it's original form. You can wrap in the middle of all the words you want and it won't change anything.
You're correct that setting the wrap to "virtual" will prevent a "real" wrap. That's definitely the ticket if the purpose is to provide code just for cut-and-paste.
But the original question did not speak of that, only of displaying the code. If you care how the code actually looks on the web page, then you do have a wrapping problem to consider. That is what I was referring to.