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="cartoon hb">
  <div class="shadow shadow-milk"></div>
  <div class="bubble milk-bubble r ha">
    Hi, Soy Milk!
  </div>
  <div class="bubble butter-bubble r ha">
    &iexcl;No, t&uacute;<br/>eres Mantequilla!
  </div>
  <div class="milk">
    <div class="carton-2 ha"></div>
    <div class="carton ha hb">
      <div class="soy">SOY</div>
      <div class="face r ha"></div>
    </div>
  </div>
  <div class="butter ha hb">
    <div class="face r ha"></div>
  </div>
</div>

<a id="youtube" href="https://www.youtube.com/watch?v=0Aqid1I6vFE" target="_blank">
  <span>See how this video was made</span>
</a>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Comic+Neue&display=swap');

html, body {
  overflow: hidden;
  background: #9db;
}

.cartoon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vmin;
  height: 80vmin;
}

.cartoon div {
  position: absolute;
  box-sizing: border-box;
}

.b {
  border: 0.5vmin solid;
}

.r {
  border-radius: 100%;
}

.hb::before,
.ha::after {
  content: "";
  display: block;
  position: absolute;
  box-sizing: border-box;
}

/****/
.milk {
  width: 30%;
  height: 45%;
  bottom: 0%;
  right: 0%;
  transform: scaleX(-1);
}

.carton {
  width: 60%;
  height: 70%;
  background: #6ad;
  bottom: 0;
  right: 0;
  transform-origin: bottom left;
  transform: skewY(-15deg);
}

.carton::before {
  width: 100%;
  height: 40%;
  top: -40%;
  background: #fff;
  transform-origin: bottom left;
  transform: skewX(27deg);
}

.carton::after {
  width: 75%;
  height: 100%;
  left: -75%;
  transform-origin: bottom right;
  background: #eee;
  transform: skewY(30deg);
}

.carton-2 {
  width: 60%;
  top: 0.25%;
  height: 6%;
  background: #fff;
  left: 19%;
  transform-origin: bottom left;
  transform: skewY(-15deg);
  background-image: repeating-linear-gradient(to right, transparent, transparent 4%, #ccc 5%)
}

.carton-2::after {
  width: 100%;
  height: 320%;
  background: #ccc;
  top: 100%;
  transform-origin: top left;
  transform: rotate(56deg);
  background-image: linear-gradient(135deg, transparent 31%, #aaa 0, transparent 33%);
}

.face {
  width: 0.75vmin;
  height: 0.75vmin;
  background: white;
  top: 45%;
  left: 40%;
  box-shadow: -0.33vmin 0.33vmin 0 0.5vmin, 5vmin 0 white, 4.66vmin 0.33vmin 0 0.5vmin, -0.25vmin 1.5vmin 1vmin 0.25vmin #f00a, 4.75vmin 1.5vmin 1vmin 0.25vmin #f00a;
}

.face::after {
  width: 300%;
  height: 150%;
  border-radius: 10vmin 10vmin 0 0;
  background: #222;
  top: 3vmin;
  left: 1.66vmin;
  background-image: radial-gradient(at 50% 100%, red 30%, transparent 0);
}

.milk-bubble {
  width: 35%;
  height: 15%;
  top: 0%;
  left: 4%;
}

.bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffd;
  font-family: "Comic Neue", verdana, arial, sans-serif;
  font-size: 3.75vmin;
  text-align: center;
}

.bubble::after {
  width: 30%;
  left: 50%;
  height: 450%;
  top: 90%;
  border-radius: 50%;
  box-shadow: 2vmin -3.5vmin 0 -1.5vmin #ffd;
}

.butter {
  width: 33%;
  height: 11%;
  background: #eee;
  bottom: 0;
  left: -20%;
  transform-origin: top right;
  transform: scaleX(-1) skewY(15deg);
}

.butter::before {
  width: 33.333%;
  height: 100%;
  left: 100%;
  background: #ddd;
  transform-origin: top left;
  transform: skewY(-30deg);
  background-image: linear-gradient(45deg, transparent 49.5%, #aaa 0 50.5%, transparent 0), linear-gradient(-45deg, transparent 49.5%, #aaa 0 50.5%, transparent 0)
}

.butter::after {
  content: "butter";
  font-size: 3vmin;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  color: red;
  display: flex;
  text-align: center;
  text-transform: uppercase;
  align-items: flex-end;
  justify-content: center;
  height: 58%;
  width: 100%;
  top: -58%;
  left: -100%;
  background: white;
  transform-origin: bottom right;
  transform: scaleX(-1) skewX(60deg);
  background-image: linear-gradient(transparent 25%, white 0), repeating-linear-gradient(to right, transparent, transparent 11%, red 12.66%);
}

.butter .face {
  top: 33%;
}

.butter .face::after {
  border-radius: 0 0 10vmin 10vmin;
}

.butter-bubble {
  top: 10%;
  right: 0;
  width: 50%;
  height: 20%;
}

.butter-bubble::after {
  height: 350%;
  left: 30%;
  width: 40%;
  box-shadow: -1.5vmin -3.5vmin 0 -1.5vmin #ffd;
  transform: rotate(-10deg);
}

.shadow {
  border-radius: 50%;
  height: 14%;
  background: #0001;
  width: 110%;
  bottom: -3%;
  left: -5%;
}

.soy {
  transform: scaleX(-1);
  text-align: center;
  width: 100%;
  top: 5%;
  color: white;
  font-size: 5vmin;
  font-family: Helvetica, arial, sans-serif;
}


/***/

#youtube {
  z-index: 2;
  display: block;
  width: 100px;
  height: 70px;
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: red;
  border-radius: 50% / 11%;
  transition: transform 0.5s;
}

#youtube:hover,
#youtube:focus {
  transform: scale(1.1);
}

#youtube::before {
  content: "";
  display: block;
  position: absolute;
  top: 7.5%;
  left: -6%;
  width: 112%;
  height: 85%;
  background: red;
  border-radius: 9% / 50%;
}

#youtube::after {
  content: "";
  display: block;
  position: absolute;
  top: 20px;
  left: 40px;
  width: 45px;
  height: 30px;
  border: 15px solid transparent;
  box-sizing: border-box;
  border-left: 30px solid white;
}

#youtube span {
  font-size: 0;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

              
            
!

JS

              
                
              
            
!
999px

Console