Pen Settings



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


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.


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.


                <input type="file" id="file">

<div class="progress">
  <div class="progress-line"></div>

<button class="read-file-btn">read file</button>

<div class="content-area">
  <textarea class="content"></textarea>


                .progress {
  height: 10px;
  width: 200px;
  border: 1px solid #ddd;
  .progress-line {
    width: 0;
    height: 10px;
    background: #c5c5c5;
    transition: .5s ease width;


                function startRead() {
  // obtain input element through DOM

  var file = document.getElementById('file').files[0];

function getAsText(readFile) {

  var reader = new FileReader();

  // Read file into memory as UTF-8
  reader.readAsText(readFile, "UTF-8");

  // Handle progress, success, and errors
  reader.onprogress = updateProgress;
  reader.onload = loaded;
  reader.onerror = errorHandler;

function updateProgress(evt) {
  if (evt.lengthComputable) {
    // evt.loaded and are ProgressEvent properties
    var loaded = (evt.loaded /;
    if (loaded < 1) { = (loaded * 100).toFixed(0) + '%';
    } else { = '100%'

function loaded(evt) {
  // Obtain the read file data
  var fileString =;
  content.value = fileString;

function errorHandler(evt) {
  if( == "NotReadableError") {
    // The file could not be read

var progressLine = document.querySelector('.progress-line')

var content = document.querySelector('.content');

document.body.addEventListener('click', function (e) {
   if ( && === "read-file-btn") {