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

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

              
                <div class="container">
  <div class="card-wrapper">
    <div class="card">
      <p>Adding a <strong>squircle effect</strong> to Claymorphism UI elements is tricky, but not impossible.</p>

      <p class="card-footer">Rahul / LogRocket</p>
    </div>
  </div>
</div>


<script>
 if ("paintWorklet" in CSS) {
  CSS.paintWorklet.addModule(
    "https://www.unpkg.com/[email protected]/squircle.min.js"
  );
}
</script>

<!-- TODO: darken the drop-shadow -->
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Lora&family=Nunito:[email protected];900&display=swap");

:root {
  displasy: none;
  box-sizing: border-box;
  font-size: 131.25%;
}

* {
  &,
  &:before,
  &:after {
    box-sizing: inherit;
  }
}

body {
  font: 1em/1.618 Nunito, sans-serif;

  color: hsl(120deg 5% 35%);
  background-color: hsl(120deg 35% 82%);
}

p {
  margin: 0;
  &:not(:last-child) {
    margin: 0 0 1.5em;
  }
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  
  min-height: 100vh;
  padding: 2em;
}

.card-wrapper {
  filter: drop-shadow(34px 34px 34px hsl(120deg 10% 50%))
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  max-width: 550px;
  min-height: 350px;
  padding: 50px;
  border-radius: 50px;

  background-color: hsl(120deg 20% 95%);
  box-shadow: 
    inset -8px -8px 16px 0px hsl(120deg 20% 50% / 70%), 
    inset 0px 14px 28px 0px hsl(120deg 20% 95%);

  // Squircle settings
  --squircle-radius: 50px;
  --squircle-smooth: 1;
  -webkit-mask-image: paint(squircle);
}

.card-footer {
  font-size: .75em;
  color: hsl(120deg 5% 50%);
}
              
            
!

JS

              
                if ("paintWorklet" in CSS) {
  CSS.paintWorklet.addModule(
    "https://www.unpkg.com/[email protected]/squircle.min.js"
  );
}

              
            
!
999px

Console