Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Save Automatically?

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.

HTML

              
                
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet'/>
  <title>Document</title>
</head>
<body>
  <div id="rollercoaster">
    
  </div>
</body>
</html>
              
            
!

CSS

              
                body {
  font-family: 'Open Sans', sans-serif;
  background: #1abc9c;
  margin: 0;
  padding: 0;
}

#rollercoaster {
  margin-top: 50px;
  text-align: center;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, .5);
  color: #ecf0f1; 
}
              
            
!

JS

              
                /*
*The Revealing Module Pattern
*Learning JavaScript Design Patterns
*A book by Addy Osmani
*/

var myApp = (function() {
  
  var text = prompt("Insert your text!") || "Make this text awesome!";
  var length = text.length;

  var div = document.getElementById('rollercoaster');
  
  /*variable for font-size*/
  var p = 20;

  /*Increase first half of a string*/
  function _increase() {
    
    /*the half of the string*/
    var length2 = Math.floor(text.length / 2);
  
    for(var i = 0; i< length2; i++ ) {
      
      /*creating spans with diferent sizes*/
      var inText = document.createTextNode(text.charAt(i));
      var span = document.createElement("span");
      span.style.fontSize = p + "px";
      span.appendChild(inText);
      div.appendChild(span);
      
      /*max font size*/
      if(p == 130) {
        p += 0;
      } else {
        p += 10;
      }
    }
  }

  /*Decrease second half of a string*/
  function _decrease() {

    var i= text.length / 2;
  
    for( i; i <= length; i++ ) {
      
      var inText = document.createTextNode(text.charAt(i));
      var span = document.createElement("span");
      span.style.fontSize = p + "px";
      span.appendChild(inText);
      div.appendChild(span);
      
    /*min font size*/
      if(p != 10) {
        p -= 10;
      }
    }
  }

  function _init() {
    _increase();
    _decrease();
  }
  
  return {
    increase: _increase,
    decrease: _decrease,
    init: _init
  };

})();

myApp.init();
              
            
!
999px

Console