Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Compass Core] Cross browser ellipsis mixin.
Since this requires the installation of an additional xml file for firefox support, it is provided as a pattern. To install: compass -p ellipsis To use: Mix +ellipsis into a selector targeting the textual element that will truncate via ellipsis. By default, ellipsis text is set tono-wrap. Pass false as the first argument if you don't want that. Note: Firefox is the lame browser in this respect, it requires a lot of bending over backwards and has many quirky behaviors. Please read the blog post at http://mattsnider.com/css/css-string-truncation-with-ellipsis/ for a full explanation of the issues. Also note that ellipsis text is white-space sensitive in Firefox, an issue that is sure to affect Haml users more than most.
- Loading branch information
1 parent
ff5c850
commit 3d909ce
Showing
6 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
This technique, by [Justin Maxwell](http://code404.com/), was originally | ||
published at http://mattsnider.com/css/css-string-truncation-with-ellipsis/ | ||
Firefox implementation by [Rikkert Koppes](http://www.rikkertkoppes.com/thoughts/2008/6/) | ||
=ellipsis(!no_wrap = true) | ||
@if !no_wrap | ||
white-space: nowrap | ||
overflow: hidden | ||
text-overflow: ellipsis | ||
-o-text-overflow: ellipsis | ||
-ms-text-overflow: ellipsis | ||
-moz-binding= stylesheet_url("xml/ellipsis.xml#ellipsis") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import compass/utilities/text/ellipsis.sass | ||
|
||
// You can delete this sass file if you want, it's just an example of how to use the ellipsis mixin. | ||
// By default, ellipsis text is no-wrap. Pass false as the first argument if you don't want that. | ||
.ellipsis | ||
+ellipsis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
file 'xml/ellipsis.xml', :like => :css | ||
stylesheet 'ellipsis.sass' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<bindings | ||
xmlns="http://www.mozilla.org/xbl" | ||
xmlns:xbl="http://www.mozilla.org/xbl" | ||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | ||
> | ||
<binding id="ellipsis"> | ||
<content> | ||
<xul:window> | ||
<xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description> | ||
</xul:window> | ||
</content> | ||
</binding> | ||
</bindings> |