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

              
                <div class="container">
  <h1>Sentence generator</h1>
  <h2 id="compliment"></h2>
  <button id="another">Another</button>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Roboto:700,100,500);

body {
  background: #000;
  color: #97e466;
  text-align: center;
  font-size: 21px;
  font-family: 'Roboto', sans-serif;
}

.container {
  margin: 3em auto;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

h2 {
  margin: 15px 0 25px;
  font-size: 30px;
  font-weight: 100;
}

button {
  background: #97e466;
  border-color: #97e466;
  border-top-color: darken(#15ec82, 8%);
  border-bottom-color: darken(#15ec82, 14%);
  border-radius: 3px;
  border-style: solid;
  border-width: 1px 1px 2px;
  color: #000;
  cursor: pointer;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
  outline: 0;
  overflow: hidden;
  padding: .4em .9em;
  text-overflow: ellipsis;
  text-decoration: none;
  vertical-align: top;
  white-space: nowrap;
  appearance: none;
  box-sizing: border-box;

  &:active {
    border-width: 2px 1px 1px
  }
}
              
            
!

JS

              
                // #3 create a random sentence generator

function getRandomInt(min, max) {
  return Math.round(Math.random() * (max - min)) + min;
}

var compliment = document.getElementById('compliment');
var one = 0;
var two = 0;

var compliments = function () {
  switch ( getRandomInt( 1, 4 ) ) {
    case 1:
      one = 'You have a beautiful';
      switch ( getRandomInt( 1, 10 ) ) {
        case 1:
          two = 'default search engine';
          break;
        case 2:
          two = 'Gruntfile.js';
          break;
        case 3:
          two = 'JS linter';
          break;
        case 4:
          two = 'keyboard layout';
          break;
        case 5:
          two = 'mailing list';
          break;
        case 6:
          two = 'table layout';
          break;
        case 7:
          two = 'CSS transition';
          break;
        case 8:
          two = 'folder structure';
          break;
        case 9:
          two = 'image minifier';
          break;
        case 10:
          two = 'LAMP stack';
          break;
      }
      break;
    case 2:
      one = "You're an incredible";
      switch ( getRandomInt( 1, 10 ) ) {
        case 1:
          two = 'Stack Overflow question asker';
          break;
        case 2:
          two = 'HTML5 implementer';
          break;
        case 3:
          two = 'Googler';
          break;
        case 4:
          two = 'alt-tabber';
          break;
        case 5:
          two = 'compiler';
          break;
        case 6:
          two = 'node package manager';
          break;
        case 7:
          two = 'single-serving app developer';
          break;
        case 8:
          two = 'sarcasm bot ghostwriter';
          break;
        case 9:
          two = 'indenter';
          break;
        case 10:
          two = 'top 10 list generator';
          break;
      }
      break;
    case 3:
      one = "You are a really strong";
      switch ( getRandomInt( 1, 10 ) ) {
        case 1:
          two = 'alt tabbist';
          break;
        case 2:
          two = 'ironic tweetist';
          break;
        case 3:
          two = 'email archiver';
          break;
        case 4:
          two = 'meetup group participant';
          break;
        case 5:
          two = 'soldering iron aficionado';
          break;
        case 6:
          two = 'SEO (Search Engine Optimist)';
          break;
        case 7:
          two = 'Spotify playlist generator';
          break;
        case 8:
          two = 'random generator generator';
          break;
        case 9:
          two = 'topical Twitter name inventor';
          break;
        case 10:
          two = 'pull requestor';
          break;
      }
      break;
    case 4:
      one = "You really have a way with";
      switch ( getRandomInt( 1, 10 ) ) {
        case 1:
          two = 'gender-neutral pronouns';
          break;
        case 2:
          two = 'style inheritance';
          break;
        case 3:
          two = 'perfectly-timed gifs';
          break;
        case 4:
          two = 'microwave-adjacent selfies';
          break;
        case 5:
          two = 'laptop sticker clustering';
          break;
        case 6:
          two = 'unicode characters';
          break;
        case 7:
          two = 'combining SVG icons';
          break;
        case 8:
          two = 'naming conventions';
          break;
        case 9:
          two = 'hacking Gibsons';
          break;
        case 10:
          two = 'minimizing the number of server requests';
          break;
      }
      break;
  }
  compliment.textContent = one + ' ' + two + '!';
};

compliments();

var another = document.getElementById('another');
another.onmousedown = function(){ compliments(); };



              
            
!
999px

Console