From 782b9f177404f02417c03abaf96b371e1462f160 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 21 Jul 2012 14:26:21 -0700 Subject: [PATCH] (bug 260) Wrap
 overflow properly.

The previous approach with overflow: hidden; had issues.
This is much better. See inline comment as well as the discussion
on bug 260 for more information and the cross-browser test.

And it took only 8 years!

* Ref:
- bug 260
- bug 414
- bug 22060

Change-Id: I7eec3ffeaa5ad633270714ce06023b29a71519f9
---
 skins/common/commonElements.css | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/skins/common/commonElements.css b/skins/common/commonElements.css
index 02fd29fe20..57f81a0fef 100644
--- a/skins/common/commonElements.css
+++ b/skins/common/commonElements.css
@@ -198,6 +198,22 @@ pre, .mw-code {
 	border: 1px dashed #2f6fab;
 	color: black;
 	background-color: #f9f9f9;
+
+	/*
+	 * Wrap properly.
+	 * - pre-wrap: 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).
+	 * - break-word: forces the browser to wrap anywhere (even within
+	 *   a word) if it is (still) too long for the line.
+	 * When only using break-word in a 
, the browser only uses
+	 * the force behavior and as a result almost always cuts half-way
+	 * a word. When only using pre-wrap, too-long words will still
+	 * cause the page layout to break. The combination is magic :).
+	 * See also https://bugzilla.wikimedia.org/show_bug.cgi?id=260#c20
+	 */
+	white-space: pre-wrap;
+	word-wrap: break-word;
 }
 
 /* Tables */
-- 
2.20.1