[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.
This commit is contained in:
parent
ff5c850014
commit
3d909ceda9
@ -3,6 +3,7 @@
|
||||
@import yui/modules/base.sass
|
||||
@import blueprint/modules/grid.sass
|
||||
@import blueprint/modules/scaffolding.sass
|
||||
@import compass/utilities/text/ellipsis.sass
|
||||
|
||||
html
|
||||
+yui-base
|
||||
@ -67,6 +68,12 @@ h2
|
||||
+outer-table-borders(2px, #151A99)
|
||||
+inner-table-borders(1px, #151A99)
|
||||
|
||||
#ellipsis
|
||||
+column(8, true)
|
||||
td
|
||||
width: 50%
|
||||
+ellipsis
|
||||
|
||||
#floats
|
||||
+column(16)
|
||||
.clearfix-example
|
||||
|
@ -139,6 +139,10 @@
|
||||
%td.numeric.even 15.5
|
||||
%td.numeric.odd 16.0
|
||||
%td.numeric.even 17.5
|
||||
#ellipsis
|
||||
.example
|
||||
%h2 Ellipsis
|
||||
%p This long text is truncated at the end of the first line. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
#floats
|
||||
.example
|
||||
%h2 Floats
|
||||
|
@ -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")
|
6
frameworks/compass/templates/ellipsis/ellipsis.sass
Normal file
6
frameworks/compass/templates/ellipsis/ellipsis.sass
Normal file
@ -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
|
2
frameworks/compass/templates/ellipsis/manifest.rb
Normal file
2
frameworks/compass/templates/ellipsis/manifest.rb
Normal file
@ -0,0 +1,2 @@
|
||||
file 'xml/ellipsis.xml', :like => :css
|
||||
stylesheet 'ellipsis.sass'
|
14
frameworks/compass/templates/ellipsis/xml/ellipsis.xml
Normal file
14
frameworks/compass/templates/ellipsis/xml/ellipsis.xml
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user