Added force-wrap mixin to prevent URLs and long lines of text from breaking layouts.

Closes GH-321
This commit is contained in:
Glenn McLelland 2011-03-25 17:21:50 -05:00 committed by Chris Eppstein
parent 87c79bcfb6
commit 239e43b4e0
6 changed files with 42 additions and 0 deletions

View File

@ -21,6 +21,7 @@ The Documentation for the [latest preview release](http://beta.compass-style.org
Set `$relative-font-sizing` to `false` to enable.
* Vertical rhythm now has a minimum padding that defaults to 2px.
This makes some edge cases look better.
* New mixin `force-wrap` prevents URLs and long lines of text from breaking layouts.
0.11.3 (06/11/2011)
-------------------

View File

@ -0,0 +1,15 @@
---
title: Wrapping Long Text and URLs
crumb: Force Wrap
framework: compass
stylesheet: compass/typography/text/_force-wrap.scss
layout: core
meta_description: Wrap URLs and long lines of text.
classnames:
- reference
- core
- typography
---
- render 'reference' do
%p
This mixin will wrap URLs and long lines of text to prevent text from breaking layouts.

View File

@ -1,3 +1,4 @@
@import "text/ellipsis";
@import "text/nowrap";
@import "text/replacement";
@import "text/force-wrap";

View File

@ -0,0 +1,12 @@
// Prevent long urls and text from breaking layouts
// [originally from perishablepress.com](http://perishablepress.com/press/2010/06/01/wrapping-content/)
@mixin force-wrap {
white-space: pre; // CSS 2.0
white-space: pre-wrap; // CSS 2.1
white-space: pre-line; // CSS 3.0
white-space: -pre-wrap; // Opera 4-6
white-space: -o-pre-wrap; // Opera 7
white-space: -moz-pre-wrap; // Mozilla
white-space: -hp-pre-wrap; // HP Printers
word-wrap: break-word; // IE 5+
}

View File

@ -0,0 +1,10 @@
pre {
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+ */
}

View File

@ -0,0 +1,3 @@
@import "compass/typography/text";
pre { @include force-wrap; }