Line-breaking non-space character |
Line-breaking non-space character |
Brian Chandler |
Apr 3 2010, 02:27 AM
Post
#1
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Well, is there one? I mean, is there a character I can insert that has no visible effect, but becomes a line-break if necessary, and is generally supported by browsers? (I want to put it in long URLs that otherwise cause havoc in tables.)
I know I could start looking at the dozens of Unicode characters that do something similar, but I would appreciate suggestions based on successful experience. |
Christian J |
Apr 5 2010, 06:11 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Can't you count the number of characters and add forced linebreaks in the server-side script? Doing so means you have to guess where the line should break, but if the column width is specified with the CSS em unit it should adjust to various text sizes.
Otherwise the ­ entity is supported by newer browsers (not FF2), but of course creates a hyphen that you may not want to be part of the URL. The WBR element is invisible, but IE8 support seems peculiar according to http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr |
Roeselhof |
Apr 6 2010, 09:58 PM
Post
#3
|
Newbie Group: Members Posts: 18 Joined: 25-February 10 Member No.: 11,214 |
I think you can only use a subset of ANSI-code - also including into unicode and coded as escape, unicode and entities.
Please look to iana's rfc's: http://www.ietf.org/rfc/rfc1766.txt http://www.ietf.org/rfc/rfc2396.txt http://www.ietf.org/rfc/rfc2732.txt Also you can view my workshop (in german): http://www1.piranho.de/home/workshops/show...2=1&id=3688 but you can translate it by google ... This post has been edited by Roeselhof: Apr 6 2010, 10:03 PM |
Brian Chandler |
Apr 6 2010, 11:41 PM
Post
#4
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Can't you count the number of characters and add forced linebreaks in the server-side script? Doing so means you have to guess where the line should break, but if the column width is specified with the CSS em unit it should adjust to various text sizes. Yes, I could have done that, since the strings are long URLs, and I would break at the closest '&'. QUOTE Otherwise the ­ entity is supported by newer browsers (not FF2), but of course creates a hyphen that you may not want to be part of the URL. The WBR element is invisible, but IE8 support seems peculiar according to http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr I found this article by Korpela, and in fact used the Unicode zero-width space "ZWSP", which works in both Opera and Firefox (the page is admin stuff for me, so I ignore IE). But then when I went to make a comment about it I couldn't for the life of me find the Korpela article again. Incidentally, I don't understand your comment about size in 'ems'. If the font is monospaced, counting characters will do; if it isn't it won't. 20em means (UIMM) 20 x width of widest letter, so if there's a row of 'i' or '|' it will come out wrong. |
Christian J |
Apr 7 2010, 07:07 AM
Post
#5
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Incidentally, I don't understand your comment about size in 'ems'. If the font is monospaced, counting characters will do; if it isn't it won't. 20em means (UIMM) 20 x width of widest letter, so if there's a row of 'i' or '|' it will come out wrong. That's true. If using a monospaced font is not an option you might specify the column width for the widest worst-case scenario. (I just got an idea about counting the number of specified very narrow and very wide characters, and adjust the total width accordingly, but lets not go there.) Not that I understand the relationship between HTML element widths and font-sizes in em, the spec at http://www.w3.org/TR/CSS21/syndata.html#length-units doesn't explain why say a 30em wide HTML element is much wider than 30 "m" letters inside it. |
Brian Chandler |
Apr 7 2010, 07:49 AM
Post
#6
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
I just checked with Betty Binns, and as I thought, the em, as in em-space, is a width equal to the height (point size) of the type, not the actual width of an 'm'.
As you say, if you know exactly which font will be used, you can calculate the exact width, but this is all over the top for what I'm doing. As usual I just want a table to adjust the columns sensibly -- which browsers generally do, unless there is a long lump stopping a column from shrinking. Thanks for your help anyway... |
pandy |
Apr 7 2010, 09:15 AM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I found this article by Korpela, and in fact used the Unicode zero-width space "ZWSP", which works in both Opera and Firefox (the page is admin stuff for me, so I ignore IE). But then when I went to make a comment about it I couldn't for the life of me find the Korpela article again. http://www.cs.tut.fi/~jkorpela/html/nobr.html#zwsp |
Christian J |
Apr 8 2010, 08:52 AM
Post
#8
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
I just checked with Betty Binns, and as I thought, the em, as in em-space, is a width equal to the height (point size) of the type, not the actual width of an 'm'. That makes sense, and actually adds up with the DIV height in my browsers: CODE div { width: 10em; height: 10em; border: solid red; line-height: 1em; } <div> 0123456789<br> 1<br> 2<br> 3<br> 4<br> 5<br> 6<br> 7<br> 8<br> 9 </div> |
Lo-Fi Version | Time is now: 23rd April 2024 - 03:27 AM |