Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcewrapmixin #321

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc-src/content/reference/compass/typography/text/force-wrap.haml
@@ -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.
@@ -1,3 +1,4 @@
@import "text/ellipsis";
@import "text/nowrap";
@import "text/replacement";
@import "text/force-wrap";
@@ -0,0 +1,12 @@
// used to prevent long urls and text from breaking layouts
// idea from 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+ */
}
10 changes: 10 additions & 0 deletions test/fixtures/stylesheets/compass/css/force-wrap.css
@@ -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+ */
}
3 changes: 3 additions & 0 deletions test/fixtures/stylesheets/compass/sass/force-wrap.scss
@@ -0,0 +1,3 @@
@import "compass/typography/text";

pre { @include force-wrap; }