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.


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.


                <div class="page">

  <button class="fun-btn">press for fun</button>



                .page {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;

/* add default color for animation start  */

/* toggle this class */

.color-bg-start {
  background-color: salmon;

/* toggle class bg-animate-color */

.bg-animate-color {
  animation: random-bg .5s linear infinite;

/* add animation to bg color  */

@keyframes random-bg {
  from {
    filter: hue-rotate(0);
  to {
    filter: hue-rotate(360deg);

.fun-btn {
  /* change bg color to get different hues    */
  background-color: salmon;
  color: white;
  padding: 2em 3em;
  border: none;
  transition: all .3s ease;
  border-radius: 5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  align-self: center;
  cursor: pointer;
  font-weight: bold;

.fun-btn:hover {
  animation: random-bg .5s linear infinite, grow 1300ms ease infinite;

.start-fun {
  background-color: #fff !important;
  /* change color of button text when fun is started   */
  color: salmon !important;

/* pulsating effect on button */
@keyframes grow {
  0% {
    transform: scale(1);
  14% {
    transform: scale(1.3);
  28% {
    transform: scale(1);
  42% {
    transform: scale(1.3);
  70% {
    transform: scale(1);


                $('.fun-btn').on('click', function(event) {
  var $page = $('.page');

  //change text when when button is clicked

  $(this).hasClass('start-fun') ?
    $(this).text('stop the fun') :
    $(this).text('start the fun');