Closed Thread Icon

Preserved Topic: to [pre] or not to [pre] (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18196" title="Pages that link to Preserved Topic: to [pre] or not to [pre] (Page 1 of 1)" rel="nofollow" >Preserved Topic: to [pre] or not to [pre] <span class="small">(Page 1 of 1)</span>\

 
lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-07-2001 15:15

hi!

I'm not able to controlt the "pre" tag behaviour...I mean i define a table with a certain width but when i put a "pre" tag within a cell ...the table grows!

How can i use something like "pre" but force it to wrap?

It might sound a silly question...but any help is appreciated..


WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-07-2001 15:34

um... define a different tag? Try using CSS and us a <p class="pre"> that mimics what the pre atribute does. Pre is ment to avoid all kinds of formatting... but you might be able to do some sort of CSS atributing to it, for that I would recommend trying www.w3.org/style/css and see what it says there.

-mage-

[This message has been edited by WarMage (edited 06-07-2001).]

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-07-2001 15:39

I agree with WarMage.
PRE means preserve all formatting, so it's doing what you ask for.
Probably you just want to use a monospaced font.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-08-2001 09:09

Don't really know what to do...

How can i disallow HTML from removing and instead keeping all the line breaks and white spaces?
I just want the same behaviour as "pre" tag but the ability to specify the max width of which it should not exceed!

Especially when i put it in a fixed width table, it just expand the table!

-=l=-

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-08-2001 20:23

<pre width="...">

width specifies the number of characters allowed on one line.

But, I'd suggest not using PRE, because there are other ways to format text. Pre is a bit primitive, and sort of messy in my opinion.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-09-2001 08:38

Slime!
I tried all the possible ways to work it out with "pre" tag but it didn't work!
I want to preserve white space characters (\n,\t,\x20...) and yet have a max width defined,
i even tried like [pre style="max-width:10px"] still didn't work! and try your method: [pre width="1"] also! as if none of these parameters exist!

Help!

If "pre" won't work then how can i preserve whitespaces and identing and stuff with CSS or another tag?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-09-2001 10:19

Why don't you convert line breaks (\n) to "<BR><BR>" and tabs (\t) to appropriate number of spaces (i.e. "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;")? Doing that you'll preserve formatting. Optionally, since you want text to wrap at certain point, you can use some server-side script to pre-process it...



[This message has been edited by mr.maX (edited 06-09-2001).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-09-2001 16:04

Alright, I'd like to see *why* you want to preserve whitespace, could you give us a link? The pre tag is probably very unecessary, and it's probably better to use a combination of HTML and CSS to create the whitespace.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 06-11-2001 08:18

Slime: the thing is that i have the following case:
i have a templace HTML file that get parsed and have "SPECIAL KEYWORDS" in it replaced with appropriate values.
example:

code:
<html><head><title>***THE_TITLE***</title></head>
<body>
<table width="200px"><tr><td>***THE_REPLACED_TEXT***</td></tr></table>
</body>
</html>


as you see that all variables within the '***' will be replaced...
but the keyword THE_REPLACED_TEXT is a string that might have white spaces and stuff...so in order to display it properly it must be in a "pre" tag...

Max: I thought of that...but it would be a real hassle for the time beeing...i want a simple solution...
Dunno...


Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-11-2001 18:23

Ah, see, I would take a different approach to this.

If you're generating THE_REPLACED_TEXT yourself, then you should just put HTML in it when you make it.

If someone else is making it, then all you need to do are find line breaks and replace them with <br>'s. (But first find double line breaks and replace them with <p>'s).

See? Try to find a way to use HTML before you resort to the pre tag. If you can, at all.

« BackwardsOnwards »

Show Forum Drop Down Menu