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

              
                <article class="contain">
  <section class="controls">
    <label class="hover-supported">
      <span>Hover Over the Pizza to Close the Box</span>
    </label>
    <label class="hover-unsupported">
      <span>Tap the Pizza to Close the Box; Tap Background to Open</span>
    </label>
  </section>
  <section class="pizza-hover">
    <div class="pizza-box">
      <div class="pizza-box-side left-side"></div>
      <div class="pizza-box-side right-side"></div>
      <div class="pizza-box-side front-side"></div>
      <div class="pizza-box-side back-side"></div>
      <div class="lid">
        <span>PIZZA</span>
      </div>
      <div class="lid-underside"></div>
      <div class="pizza">
        <div class="sauce">
          <div class="toppings">
            <div class="mozzarella"></div>
            <div class="mushroom"></div>
            <div class="mozzarella"></div>
            <div class="basil"></div>
            <div class="mozzarella"></div>
            <div class="basil"></div>
            <div class="mushroom"></div>
            <div class="mozzarella"></div>
            <div class="mushroom"></div>
            <div class="mozzarella"></div>
            <div class="basil"></div>
            <div class="mozzarella"></div>
          </div>
        </div>
      </div>
    </div>
  </section>
</article>
              
            
!

CSS

              
                .contain {
  align-items: center;
  background: radial-gradient(
    ellipse at center,
    #fff 0%,
    #e570e7 40%,
    #c85ec7 60%,
    #a849a3 100%
  );
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  overflow: hidden;
  padding-top: 30vh;
  position: absolute;
  right: 0;
  top: 0;
}
@keyframes still {
  from {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(45deg);
  }
  to {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(45deg);
  }
}
@keyframes spin {
  from {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(360deg);
  }
}

@media not all and (hover: none) {
  .hover-unsupported {
    display: none;
  }
}

@media not all and (hover: hover) {
  .hover-supported {
    display: none;
  }
}

.controls {
  background: #333;
  border-radius: 2vh;
  color: #fff;
  left: 1vh;
  padding: 2vh;
  position: absolute;
  bottom: 1vh;
}

.pizza-box {
  // animation: still 4.5s infinite linear;
  animation: spin 4.5s infinite linear;
  background: #fff;
  box-shadow: 0 0 6vh 2vh rgba(0, 0, 0, 0.4) inset;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60vh;
  position: relative;
  transform-style: preserve-3d;
  width: 60vh;
}

.lid-underside,
.lid {
  align-items: center;
  color: red;
  background-color: #f6f6f6;
  box-shadow: 0 0 4vh 1vh rgba(0, 0, 0, 0.2) inset;
  display: flex;
  // display: none;
  font-size: 14vh;
  height: 60vh;
  justify-content: center;
  position: absolute;
  text-align: center;
  transform: rotateX(86deg) translateY(3.9vh) translateZ(0.2vh);
  transform-origin: top center;
  transition: transform 0.3s ease-in;
  width: 60vh;
  z-index: 1;
}
.lid-underside {
  background-color: #dedede;
  transform: rotateX(86deg) translateY(4vh) translateZ(0.1vh);
}
.lid span {
  border: 2vh red solid;
  padding: 0 2vh;
}
.pizza-box:hover .lid {
  transform: rotateX(0deg) translateY(0) translateZ(4vh);
}
.pizza-box:hover .lid-underside {
  transform: rotateX(0deg) translateY(0) translateZ(3.9vh);
}

.pizza-box-side {
  background-color: #f6f6f6;
  box-shadow: 0 0 4vh 1vh rgba(0, 0, 0, 0.2) inset;
  height: 4vh;
  position: absolute;
  transform: rotateX(90deg);
  transform-origin: top;
  width: 60vh;
}
.front-side {
  background: linear-gradient(to right, rgba(214,214,214,1) 0%,rgba(246,246,246,1) 15%,rgba(246,246,246,1) 100%);
  transform: translateY(-28vh) rotateX(90deg);
}
.back-side {
  background-color: #bbb;
  bottom: -4vh;
}
.left-side {
  background-color: #ccc;
  transform: rotateX(90deg) rotateY(90deg) rotateZ(0deg) translateX(-28vh);
  transform-origin: 0 top;
}
.right-side {
  background-color: #ddd;
  bottom: -4vh;
  transform: rotateX(90deg) rotateY(90deg) rotateZ(0deg);
  transform-origin: 100% top;
}

.pizza {
  background-color: #ffd161;
  border-radius: 50%;
  box-shadow: 0 0 1.8vh 1.5vh rgb(173, 117, 81) inset;
  // 0 0 1vh 0.4vh rgba(0, 0, 0, 0.4);
  display: block;
  height: 50vh;
  padding: 4vh;
  transform-style: preserve-3d;
  width: 50vh;
}

.sauce {
  background-color: #ed423b;
  box-shadow: 0 0 1.5vh 1.3vh #bd4b00 inset;
  border-radius: 50%;
  position: absolute;
  transform: translateZ(2vh);
  transform-origin: center;
}

.toppings {
  display: grid;
  grid-gap: 0;
  grid-template-columns: repeat(4, 25%);
  grid-template-rows: repeat(4, 25%);
  grid-template-areas:
    ". a b ."
    "c d e f"
    "g h i j"
    ". k l .";
  height: 46vh;
  padding: 2vh;
  width: 46vh;
}

.basil {
  background-color: #498749;
  border-radius: 50% 0 50% 0;
  box-shadow: -1vh 0 1vh 0 #8ac059 inset;
  height: 8vh;
  width: 8vh;
}

.mozzarella {
  background: #fff;
  border-radius: 50%;
  box-shadow: 1vh 0.2vh 0.2vh 0 #a86306 inset, 3vh -3vh 0 -1.5vh #fff,
    3vh 3vh 0 -1.2vh #fff, 3vh -1vh 0 -2vh #fff, -2vh 2vh 0 -1vh #fff, 
    -2vh -2.5vh 0 -1.5vh #fff;;
  height: 8vh;
  width: 8vh;
}

.mushroom {
  background: #fff;
  border-radius: 20%;
  height: 8vh;
  margin: 2vh 4vh;
  width: 4vh;
}
.mushroom:after,
.mushroom:before {
  content: "";
  display: block;
}
.mushroom:before {
  background: #c8c3b0;
  border-radius: 4vh 4vh 2vh 2vh;
  height: 5vh;
  margin-left: -3vh;
  width: 10vh;
}
.toppings * {
  place-self: center;
}
.toppings *:nth-child(1) {
  grid-area: a;
  transform: rotateZ(20deg);
}
.toppings *:nth-child(2) {
  grid-area: b;
  transform: rotateZ(40deg);
}
.toppings *:nth-child(3) {
  grid-area: c;
  transform: rotateZ(330deg);
}
.toppings *:nth-child(4) {
  grid-area: d;
  transform: rotateZ(96deg);
}
.toppings *:nth-child(5) {
  grid-area: e;
  transform: rotateZ(213deg);
}
.toppings *:nth-child(6) {
  grid-area: f;
  transform: rotateZ(247deg);
}
.toppings *:nth-child(7) {
  grid-area: g;
  transform: rotateZ(145deg);
}
.toppings *:nth-child(8) {
  grid-area: h;
  transform: rotateZ(50deg);
}
.toppings *:nth-child(9) {
  grid-area: i;
  transform: rotateZ(114deg);
}
.toppings *:nth-child(10) {
  grid-area: j;
  transform: rotateZ(7deg);
}
.toppings *:nth-child(11) {
  grid-area: k;
  transform: rotateZ(161deg);
}
.toppings *:nth-child(12) {
  grid-area: l;
  transform: rotateZ(261deg);
  // transform: rotateZ(random(360) + deg);
}

              
            
!

JS

              
                
              
            
!
999px

Console