https://bugzilla.wikimedia.org/show_bug.cgi?id=260

--- Comment #20 from Krinkle <[email protected]> 2012-07-21 21:14:23 UTC ---
When talking about this with Trevor we both had the same idea, but came up with
different implementations that seemed the same at first.

Trevor suggested "white-space: pre-wrap;" and I suggested "word-wrap:
break-word;". Both appear to do the same thing when used in a <pre> (when not
used on a <pre>, but on a <p> the difference is much more obvious).

When used on a <pre> there is a sudle difference.

* "white-space: pre-wrap;"

This causes the browser to naturally wrap by displaying words on the next line
if they don't fit on the same line within the box (does not cut off words). At
first sight this appears to be a nice solution, however long urls or JSON
strings will often still break out of the box and cause the page layout to look
broken.

* "word-wrap: break-word:"

This forces the browser to wrap anywhere (even within when the spot is not a
word boundry) when the line becomes too long.


The latter doesn't have the problem with long urls and JSON strings, but... it
always breaks the word, even a short word such as "the" will be wrapped on 2
lines if it happens to be at the cut-off point of the <pre> box dimensions.

The best solution appears to combine the two. That way the browser will first
naturally wrap the lines in a natural way (if a word doesn't fit it puts the
entire word on the next line), and then break-word will only step in if
necessary. Browser support for both of these are very good. I'll do some
testing and come up with a patch on monday.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to