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

              
                <!--  THE SVG THAT SHOULD BE A SEPARATE FILE AND USED AS A BACKGROUND IN CSS -->
<!--   

<svg viewBox='0 0 500 500' xmlns='http://www.w3.org/2000/svg'>
  <filter id='noiseFilter'>
    <feTurbulence 
      type='fractalNoise' 
      baseFrequency='0.65' 
      numOctaves='3' 
      stitchTiles='stitch'/>
  </filter>
  
  <rect width='100%' height='100%' filter='url(#noiseFilter)'/>
</svg>
 -->

<!-- See: https://grainy-gradients.vercel.app -->
<body>
  <p>Grainy<br />Shadows</p>
  <section>
    <div class="ground">
      <div class="ground-shadow"></div>
    </div>
    <div class="ball">
      <div class="isolate">
        <div class="ball-shadow"></div>
        <div class="ball-light"></div>
      </div>
    </div>

  </section>
</body>
              
            
!

CSS

              
                body {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: lightsalmon;
  height: 100vh;
}

p {
  padding-top: 150px;
  padding-right: 20px;
  z-index: 30;
  transform: skewX(-14deg) rotateX(37deg);
  color: rgba(255,255,255,0.5);
  font-weight: 700;
  font-size: 4em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

section {
  position: relative;
  width: 250px;
}

.ball {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 250px;
  width: 250px;
  border-radius: 125px;
  overflow: hidden;
  z-index: 20;
}

/* Isolation creates a new stacking context for mix-blend-mode. See: https://developer.mozilla.org/en-US/docs/Web/CSS/isolation */
.isolate {
  isolation: isolate;
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
}

/* Magic: using the noise SVG as a background, and then upping the contrast and brightness

/* Note: Importing the noise.svg from an external site, but in practice you would simply point to the svg file as a relative path. (Referencing its id doesn't work either) */

.ball-shadow {
  height: 100%;
  background: radial-gradient(circle at 65% 35%, rgba(0, 0, 0, 0), mediumblue), url(https://grainy-gradients.vercel.app/noise.svg);     
  filter: contrast(120%) brightness(900%);
}

/* The smooth gradient to give the ball some sheen. Blending with the noise further sharpens it. */

.ball-light {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 67% 30%, lightsalmon, crimson);
  mix-blend-mode: multiply;
}

/* To continue the demo of noise, the shadow on the ground. No isolation here, so the blending includes the background */
.ground {
  position: absolute;
  width: 150%;
  height: 140px;
  bottom: -10px;
  left: -65%;
  transform: rotateZ(7deg);
  mix-blend-mode: multiply;
}

.ground-shadow {
  width: 95%;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 70%, navy, rgba(0, 0, 0, 0)), url(https://grainy-gradients.vercel.app/noise.svg);
  filter: contrast(150%) brightness(700%);
}
              
            
!

JS

              
                
              
            
!
999px

Console