By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Adding "soft-hyphen"

P: n/a
My PHP script builds a table that is too wide to fit on the paper. Two
of the columns contain strings that are more lengthy than data in the
other columns.

I can get the table to fit by letting the browser break the lengthy
strings across two or more lines, thus allowing the column to get
skinnier. I do this by inserting spaces in various places in the
string. But this is not a desirable solution as it would mislead the
user into thinking the string contains spaces when it doesn't.

Is there an invisible character code I can insert into the string that
tells the browser that it is allowed to line-wrap the string at this
place, if needed? Popular word processors have a feature like this
called "soft hyphens" or "soft breaks", etc.

Mark
Sep 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Mark wrote:
My PHP script builds a table that is too wide to fit on the paper. Two
of the columns contain strings that are more lengthy than data in the
other columns.

I can get the table to fit by letting the browser break the lengthy
strings across two or more lines, thus allowing the column to get
skinnier. I do this by inserting spaces in various places in the
string. But this is not a desirable solution as it would mislead the
user into thinking the string contains spaces when it doesn't.

Is there an invisible character code I can insert into the string that
tells the browser that it is allowed to line-wrap the string at this
place, if needed? Popular word processors have a feature like this
called "soft hyphens" or "soft breaks", etc.


You must have something in your html/css that is preventing line wrap.
Default is for table text to wrap. Also check the way you have defined
table width - 90% will force the table to fit in the view size.

--
TK
http://www.wejuggle2.com/
Still Having a Ball
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?



..

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sep 12 '05 #2

P: n/a
Terry wrote:

You must have something in your html/css that is preventing line wrap.
Default is for table text to wrap. Also check the way you have defined
table width - 90% will force the table to fit in the view size.

In Firefox, at least, text in cells will not be wrapped unless there is
a break point, such as whitespace. If a have long text without
whitespace in a column, such as a URL, Firefox will stretch the width of
the column to the minimum necessary to show the full string without a
line-wrap. I don't know if this is the case with IE, yet, as I am not
in a location that I have access to the password-protected page in question.

Mark
Sep 12 '05 #3

P: n/a
In article <dg**********@news.nems.noaa.gov>, Mark <Ma**********@noaa.gov>
wrote:
My PHP script builds a table that is too wide to fit on the paper. Two
of the columns contain strings that are more lengthy than data in the
other columns.

I can get the table to fit by letting the browser break the lengthy
strings across two or more lines, thus allowing the column to get
skinnier. I do this by inserting spaces in various places in the
string. But this is not a desirable solution as it would mislead the
user into thinking the string contains spaces when it doesn't.

Is there an invisible character code I can insert into the string that
tells the browser that it is allowed to line-wrap the string at this
place, if needed? Popular word processors have a feature like this
called "soft hyphens" or "soft breaks", etc.


Well, as far as I know, there is no way to tell the browser to linewrap a long
string to a certain width, only when the string is divided into words, but not
a consecutive string of characters.

A solution could be to put the long field on a row of its own, spanning the
width of the other values.

If the field values are:

1. Foo
2. Bar
3. Donkey
4. Monkey
5. VeryLongStringThatMessesUpWidth

And the table looks like this in crappy ASCII art:

+------+------+---------+---------+---------------------------------+
| Foo | Bar | Monkey | Donkey | VeryLongStringThatMessesUpWidth |
+------+------+---------+---------+---------------------------------+

And field 5 is the same for all lines in the report, you could divide it like
this:

<tr>
<td>Foo</td>
<td>Bar</td>
<td>Donkey</td>
<td>Monkey</td>
</tr>
<tr>
<td colspan='4'>VeryLongStringThatMessesUpWidth</td>
</tr>

Which, in crappy ASCII art would look like this:

+------+------+---------+---------+
| Foo | Bar | Monkey | Donkey |
+------+------+---------+---------+
| VeryLongStringThatMessesUpWidth |
+---------------------------------+

Set style="background-color: #CCC" on the first <tr> to make them be dividers
for each long value.

Hope this helped.

--
Sandman[.net]
Sep 12 '05 #4

P: n/a
On Mon, 12 Sep 2005 08:03:21 -0400, Mark <Ma**********@noaa.gov> wrote:
My PHP script builds a table that is too wide to fit on the paper. Two
of the columns contain strings that are more lengthy than data in the
other columns.

I can get the table to fit by letting the browser break the lengthy
strings across two or more lines, thus allowing the column to get
skinnier. I do this by inserting spaces in various places in the
string. But this is not a desirable solution as it would mislead the
user into thinking the string contains spaces when it doesn't.

Is there an invisible character code I can insert into the string that
tells the browser that it is allowed to line-wrap the string at this
place, if needed? Popular word processors have a feature like this
called "soft hyphens" or "soft breaks", etc.


Have a look at http://www.cs.tut.fi/~jkorpela/shy.html for a fairly involved
discussion of the HTML equivalent.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 12 '05 #5

P: n/a
Andy Hassall wrote:

Have a look at http://www.cs.tut.fi/~jkorpela/shy.html for a fairly involved
discussion of the HTML equivalent.


Actually, It was Jukka Korpela who pointed out in another post that I
could use the <wbr> tag to indicate a permissible place for a line
break. This is used inside <nobr> tags, which seems counter-intuitive
at first, but it gives you control as to exactly where you will permit a
line break and nowhere else...

I've already tried it, and <wbr> works well for IE, but Firefox just
ignores it.

Mark
Sep 12 '05 #6

P: n/a
On Mon, 12 Sep 2005 13:31:59 -0400, Mark <Ma**********@noaa.gov> wrote:
Andy Hassall wrote:

Have a look at http://www.cs.tut.fi/~jkorpela/shy.html for a fairly involved
discussion of the HTML equivalent.


Actually, It was Jukka Korpela who pointed out in another post that I
could use the <wbr> tag to indicate a permissible place for a line
break. This is used inside <nobr> tags, which seems counter-intuitive
at first, but it gives you control as to exactly where you will permit a
line break and nowhere else...

I've already tried it, and <wbr> works well for IE, but Firefox just
ignores it.


Neither <nobr> nor <wbr> exist in HTML 4.01, so Firefox is correct in ignoring
them.

http://www.w3.org/TR/html401/index/elements.html

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 12 '05 #7

P: n/a
>>
I've already tried it, and <wbr> works well for IE, but Firefox just
ignores it.

Neither <nobr> nor <wbr> exist in HTML 4.01, so Firefox is correct in ignoring
them.

http://www.w3.org/TR/html401/index/elements.html


It's _very_ unfortunate that neither Firefox or HTML 4.01 embrace this
useful tag. Furthermore, Firefox also ignores the ­ or ­ code
which _IS_ part of the HTML 4 standard
(http://www.w3.org/TR/html401/sgml/entities.html). Now I'm relegated to
having to post a message that says something to the effect of... "For
best results with a printed copy of this table, use Internet Explorer." :(

Mark
Sep 12 '05 #8

P: n/a
On Mon, 12 Sep 2005 14:35:37 -0400, Mark <Ma**********@noaa.gov> wrote:
I've already tried it, and <wbr> works well for IE, but Firefox just
ignores it.
Neither <nobr> nor <wbr> exist in HTML 4.01, so Firefox is correct in ignoring
them.

http://www.w3.org/TR/html401/index/elements.html


It's _very_ unfortunate that neither Firefox or HTML 4.01 embrace this
useful tag.


I think Firefox is correct in not supporting non-existent tags; nobody wants
the bad old days of <marquee><blink>made-up tags</blink></marquee> to be
encouraged.
Furthermore, Firefox also ignores the ­ or ­ code
which _IS_ part of the HTML 4 standard
(http://www.w3.org/TR/html401/sgml/entities.html).


But here I strongly agree with you; Firefox's lack of support for the proper
way of doing discretionary hyphens is unfortunate.

There is a change request for this, though, which you may want to add your
vote to:

https://bugzilla.mozilla.org/show_bug.cgi?id=9101

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.