Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML breakable space

Status
Not open for further replies.

Rodie

Programmer
Jun 27, 2004
132
FR
Hi all

You know that   is the HTML non-breakable space.
The problem is that I would like a breakable space so that my text goes to the line without scrollbar.

And I cannot use the empty character " " (or space) because I work in an array and " " has the same effect as " ".

Does a breakable space exists ?
Thanks for your help :)
 
Try one of these:
[tt]
en space    
em space    
thin space    
[/tt]
 
Hey !

Unfortunaly your 3 statements does not work ..
But someone in my office proposed: <PRE>
It works perfectly !!
Thanks for your help !
 
Actually <pre> is annoying because all the text in <pre></pre> has the format of my environment text, and the text goes to the line tons of times instead one ... damn ...

That if you have any other smart idea :)
 
pre means "preformatted" it's used for log sections of "code" where tabs and spaces are important to readabiliry (as is lining things up). You could use the <pre></pre> arround just those spaces, but this is a cheap trick -- and pre is a block level element which will cause problems. I suppose you could try <code></code> (which is phrase level) but I'm not sure if it'd fit your needs.

moreover &emsp;, &ensp;, and &thinsp; do "work" to create what they promise -- no more no less. What are you trying to break in the middle of spaces? The easiest is to:
Code:
text here blah blah&nbsp; blah
so the first space will be connected to the first word and will not break, but the second will break and the last blah will appear on a new line.

It might help to show what you are trying to do.

[plug=shameless]
[/plug]
 
Hi Streich

Yes you are right about <pre> and <code>. I tried before but they did not work as expected. <pre> </pre> goes to the line many times, instead of inserting just spaces ...

Finally what I decided to do:
I insert " " between words, and &nbsp; when a word is empty (when you are several spaces one after the other). It won't go to the line if you have many &nbsp; but it's ok ... never mind

Thanks a lot for your help :)
 
Yes you are right about <pre> and <code>. I tried before but they did not work as expected. <pre> </pre> goes to the line many times, instead of inserting just spaces ...
<pre>lala</pre> is block level and so they are protected from other blocks by a line above and bellow, so
Code:
<pre>  </pre>
would result in a newline,the whitespaces, and another new line. <code></code> should have worked, though not ideal.

Glad you have it working.

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top