Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="beer">
  <!-- Sorry people on phones! It's a tad big! -->
  <svg xmlns="http://www.w3.org/2000/svg" width="395.629" height="512">
    <path d="M319.213 388.5H275.63v-44h43.583a22.443 22.443 0 0022.416-22.417v-79.166a22.443 22.443 0 00-22.416-22.417H275.63v-44h43.583a66.492 66.492 0 0166.416 66.417v79.166a66.492 66.492 0 01-66.416 66.417zM265.67 502H40.633a26.854 26.854 0 01-24.706-37.377L30.673 430H275.63l14.747 34.623A26.855 26.855 0 01265.67 502z" fill="#c7ebfa" />
    <path d="M30.673 112h244.956v318H30.673z" fill="#fff" />
    <path d="M30.673 209h244.956v221H30.673z" fill="#f2cd69" id="liquid" />
    <g clip-path="url(#liquid)">
      <circle class="bubble0" fill="black" cx="60" cy="430" r="10" />
      <circle class="bubble1" fill="black" cx="75" cy="430" r="5" />
      <circle class="bubble2" fill="black" cx="100" cy="430" r="8" />
      <circle class="bubble3" fill="black" cx="150" cy="430" r="9" />
      <circle class="bubble4" fill="black" cx="180" cy="430" r="6" />
      <circle class="bubble5" fill="black" cx="230" cy="430" r="7" />
    </g>
    <path d="M268.124 63.908a39.487 39.487 0 00-14.332 2.678 2.841 2.841 0 01-3.894-2.632v-.046a53.908 53.908 0 00-102.23-23.9 39.778 39.778 0 00-68.824 17.884 39.672 39.672 0 00-29.49-12.618C27.434 45.508 10 63.836 10 85.757v110.91c0 17.411 14.249 31.992 31.657 31.659a31.052 31.052 0 0030.446-31.046V146.7a20.265 20.265 0 0129.279-18.131 110.993 110.993 0 00103.665-3.037 27.978 27.978 0 0134.13 5.147 39.6 39.6 0 0031.636 12.449c18.582-1.226 35.469-17.957 36.852-36.529a39.66 39.66 0 00-39.542-42.691z" fill="#fcf3da" />
    <path d="M319.213 166.5h-33.582v-16.662c17.28-6.922 30.609-23.715 32.007-42.5a49.245 49.245 0 00-13.116-37.555A49.724 49.724 0 00259.238 54.7a63.931 63.931 0 00-113.841-29.87A49.744 49.744 0 0074.389 41.8a49.934 49.934 0 00-25.141-6.52A48.712 48.712 0 0031.013 39a10 10 0 107.659 18.474 28.833 28.833 0 0110.785-2.2 29.666 29.666 0 0122.08 9.45 10 10 0 0017.083-4.747A29.778 29.778 0 01140.149 46.6a10 10 0 0016.479-2.154 43.909 43.909 0 0183.27 19.506 12.842 12.842 0 0017.515 11.955 29.661 29.661 0 0140.28 29.95c-1.016 13.638-13.884 26.392-27.538 27.292a29.68 29.68 0 01-23.685-9.312 37.777 37.777 0 00-46.366-7 100.579 100.579 0 01-94.3 2.762 30.265 30.265 0 00-43.7 27.1v50.584a21.154 21.154 0 01-20.637 21.048 20.63 20.63 0 01-14.863-6.019 22.062 22.062 0 01-6.6-15.643v-65.91a10 10 0 10-20 0v65.91a42.182 42.182 0 0012.6 29.92 41.722 41.722 0 008.077 6.2v195.17L6.727 460.7A36.854 36.854 0 0040.633 512H265.67a36.854 36.854 0 0033.907-51.3l-13.947-32.745V398.5h33.583a76.5 76.5 0 0076.416-76.417v-79.166a76.5 76.5 0 00-76.416-76.417zm-33.584 64h33.584a12.431 12.431 0 0112.416 12.417v79.166a12.431 12.431 0 01-12.416 12.417H285.63zM82.103 146.7a10.031 10.031 0 014.819-8.683 10.146 10.146 0 0110.038-.479 120.559 120.559 0 00113.03-3.312 18.062 18.062 0 0121.893 3.295 49.532 49.532 0 0033.748 15.627V199H82.061c.024-.57.044-1.142.044-1.718V146.7zm-41.039 91.634q.392 0 .784-.008A41.164 41.164 0 0075.798 219h189.831v201H40.674V238.324c.13 0 .26.01.39.01zM279.73 484.44a16.594 16.594 0 01-14.06 7.56H40.633a16.854 16.854 0 01-15.506-23.458L37.283 440H269.02l12.156 28.542a16.594 16.594 0 01-1.446 15.898zm95.9-162.357a56.481 56.481 0 01-56.417 56.417h-33.582v-24h33.582a32.453 32.453 0 0032.416-32.417v-79.166a32.453 32.453 0 00-32.416-32.417h-33.582v-24h33.582a56.481 56.481 0 0156.416 56.417z" />
  </svg>
</div>
              
            
!

CSS

              
                body {
  font-family: "Balsamiq Sans", cursive;
  margin: 0;
  padding: 0;
  position: relative;
  height: 100vh;
  width: 100vw;
  background-color: aquamarine;
}

.beer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

              
            
!

JS

              
                // Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>

// New TimelineMax object
const animation = new TimelineMax();

// Loop through bubbles 0 - 5
for (let i = 0; i < 6; i++) {
  let bubble = TweenMax.to(
    document.querySelector(".bubble" + i),
    Math.floor(Math.random() * 10) + 5,
    {
      // Add execution time to each buble between 5 - 10
      y: -220, // height of beer liquid
      repeat: -1,
      repeatDelay: Math.floor(Math.random() * 3) + 1, // delay between 1 - 3
      yoyo: false,
      ease: Linear.easeNone
    }
  );

  // Add bubble to animation timeline with stagger
  animation.add(bubble, (i + 2) / 0.3);
}

animation.seek(60); // Jump to 60 seconds into the animation

              
            
!
999px

Console