Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Truncates lines of text to fit within a container
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Assets
Demos
Docs
Source
README.md
package.yml

README.md

FitText

FitText

Truncates the text nodes of elements to fit inside a container

How to use

Example:

HTML:

#HTML
<ul id="container">
    <li><span>Lorem ipsum dolor</span></li>
    <li><span>sit amet, consectetur adipisicing</span></li>
    <li><span>elit, sed do eiusmod tempor incididunt ut labore et</span></li>
</ul>

CSS:

#CSS
ul {
    list-style: none;
    width: 50%;
}

li {
    white-space: nowrap;
}

JavaScript

#JS
var myFitText = new FitText('container','li > span',{
  offset: 20,
  fitClass: 'fitted'
});

View the MooDoc for usage and examples.

Something went wrong with that request. Please try again.