Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
  <div class="text-expander">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus orci lorem, ullamcorper in suscipit vel, rhoncus at erat. Nam ultrices mollis orci, et pretium arcu consectetur eget. Integer elementum nibh justo. Nullam ullamcorper semper ornare. Nulla sed lectus est, vel iaculis dui. Duis consequat placerat tortor, eget iaculis est iaculis eget. In eu justo nisi. Cras cursus ligula eu erat tincidunt accumsan. Morbi vitae pharetra lacus. Curabitur ultricies dolor a tellus imperdiet at volutpat risus tristique. Praesent eget faucibus elit. Integer sed volutpat diam. Nunc ut lorem non tellus gravida iaculis. Curabitur consequat, magna eget imperdiet vestibulum, neque elit rhoncus sem, sit amet lacinia est nulla id purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus non diam eget nulla interdum varius.
    In dictum adipiscing odio ut consectetur. Praesent nec libero vitae ligula suscipit varius eu lobortis ligula. Mauris commodo diam nec tortor congue placerat. Aliquam ultricies, erat et porttitor convallis, mauris justo ultrices orci, sit amet ullamcorper tortor libero ac eros. Nulla sed justo tellus. Donec imperdiet turpis id sem placerat semper. Sed varius vestibulum ligula, quis pharetra leo auctor non. Praesent adipiscing metus sodales justo dictum vel volutpat mi rutrum. Quisque sed eros eget est porta mollis a nec nibh. Aliquam erat volutpat. Sed imperdiet urna tincidunt erat consectetur in aliquam metus elementum.
  <div class="btn-text-expander">Read more</div>


                /* only for demo */
.container {
  font-family: 'Courier New', monospace;
  padding-top: 40px;
  max-width: 400px;
  margin: 0 auto;
.btn-text-expander {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 14px;
  border-radius: 3px;
  background-color: #665aef;
  color: #fff;

/* code */
.text-expander {
  height: 70px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
} {
  display: inherit;
  height: auto;


                $('.btn-text-expander').on('click', function() {
  var button_text = ($('.text-expander').hasClass('active')) ? 'Read more' :'Read less';