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

              
                <img src="https://images.unsplash.com/photo-1567911342145-96a7bd51c8dc?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt=" " id="image">

<card class="neumorphic">
  <div>
    <input type="color" name="color" id="color" value="#45494c" class="neumorphic" oninput="changeColor()">
  </div>
  <div>
    <input type="range" name="opacity" id="opacity" value="30" min="0" max="100" oninput="changeOpacity()">
  </div>
  <div>
    <input type="checkbox" name="img" id="img" checked oninput="changeImg()"><label for="img"><span>image</span></label>
  </div>
</card>
              
            
!

CSS

              
                body {
  --color: hsl(210deg,10%,30%);
  --opacity: 30;
  background: var(--color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: #fff;
}

.neumorphic {
  border-radius: 1rem;
  background: var(--color);
  // Opacify any color with pure CSS
  animation: 1s calc(var(--opacity) * -.01s) 1 paused both opacify;
  backdrop-filter: blur(1.5rem);
  border: 1px solid rgba(#fff,.2);
  box-shadow:
    -.25rem -.25rem .5rem rgba(#fff,.07),
    .25rem .25rem .5rem rgba(#000,.12),
    -.75rem -.75rem 1.75rem rgba(#fff,.07),
    .75rem .75rem 1.75rem rgba(#000,.12),
    inset 8rem 8rem 8rem rgba(#000,.05),
    inset -8rem -8rem 8rem rgba(#fff,.05)
  ;
}
@keyframes opacify { to {
  background: transparent;
}}

card {
  position: absolute;
  top: 50vh;
  left: 50vw;
  width: 400px;
  height: 300px;
  max-width: 80vw;
  max-height: 80vh;
  transform: translate(-50%,-50%);
  box-sizing: border-box;
  padding: .5rem;
}

div {
  margin-bottom: 1rem;
}

img {
  position: absolute;
  top: 2rem;
  bottom: 2rem;
  right: 2rem;
  object-fit: cover;
  width: calc(50vw - 2rem);
  height: calc(100vh - 4rem);
  box-shadow: 0 1rem 2rem rgba(#000,.3);
  border-radius: .2rem;
  &.hidden {
    display: none;
  }
}

input.neumorphic {
  width: 1rem;
  height: 1rem;
  border: 0;
  padding: 0;
  border-radius: 50%;
  display: block;
  border: 1px solid rgba(#fff,.5);
  cursor: pointer;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch {
  opacity: 0;
}

// Styling Cross-Browser Compatible Range Inputs with Sass
// Github: https://github.com/darlanrod/input-range-sass
// Author: Darlan Rod https://github.com/darlanrod
// Version 1.5.2
// MIT License

$track-color: rgba(#fff,.4) !default;
$thumb-color: var(--color) !default;

$thumb-radius: 50% !default;
$thumb-height: 18px !default;
$thumb-width: 18px !default;
$thumb-shadow-size: 3px !default;
$thumb-shadow-blur: 4px !default;
$thumb-shadow-color: rgba(0, 0, 0, .1) !default;
$thumb-border-width: 1px !default;
$thumb-border-color: rgba(#fff,.6) !default;

$track-width: 100% !default;
$track-height: 1px !default;
$track-shadow-size: 1px !default;
$track-shadow-blur: 1px !default;
$track-shadow-color: rgba(0, 0, 0, .2) !default;
$track-border-width: 0 !default;
$track-border-color: #fff !default;

$track-radius: 5px !default;
$contrast: 5% !default;

$ie-bottom-track-color: darken($track-color, $contrast) !default;

@mixin shadow($shadow-size, $shadow-blur, $shadow-color) {
  box-shadow: $shadow-size $shadow-size $shadow-blur $shadow-color, 0 0 $shadow-size lighten($shadow-color, 5%);
}

@mixin track {
  cursor: default;
  height: $track-height;
  transition: all .2s ease;
  width: $track-width;
}

@mixin thumb {
  @include shadow($thumb-shadow-size, $thumb-shadow-blur, $thumb-shadow-color);
  background: $thumb-color;
  border: $thumb-border-width solid $thumb-border-color;
  border-radius: $thumb-radius;
  box-sizing: border-box;
  cursor: default;
  height: $thumb-height;
  width: $thumb-width;
}

[type='range'] {
  -webkit-appearance: none;
  background: transparent;
  margin: $thumb-height / 2 0;
  width: $track-width;

  &::-moz-focus-outer {
    border: 0;
  }

  &:focus {
    outline: 0;

    &::-webkit-slider-runnable-track {
      background: lighten($track-color, $contrast);
    }

    &::-ms-fill-lower {
      background: $track-color;
    }

    &::-ms-fill-upper {
      background: lighten($track-color, $contrast);
    }
  }

  &::-webkit-slider-runnable-track {
    @include track;
    @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: $track-radius;
  }

  &::-webkit-slider-thumb {
    @include thumb;
    -webkit-appearance: none;
    margin-top: ((-$track-border-width * 2 + $track-height) / 2 - $thumb-height / 2);
  }

  &::-moz-range-track {
    @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    @include track;
    background: $track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: $track-radius;
    height: $track-height / 2;
  }

  &::-moz-range-thumb {
    @include thumb;
  }

  &::-ms-track {
    @include track;
    background: transparent;
    border-color: transparent;
    border-width: ($thumb-height / 2) 0;
    color: transparent;
  }

  &::-ms-fill-lower {
    @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $ie-bottom-track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: ($track-radius * 2);
  }

  &::-ms-fill-upper {
    @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: ($track-radius * 2);
  }

  &::-ms-thumb {
    @include thumb;
    margin-top: $track-height / 4;
  }

  &:disabled {
    &::-webkit-slider-thumb,
    &::-moz-range-thumb,
    &::-ms-thumb,
    &::-webkit-slider-runnable-track,
    &::-ms-fill-lower,
    &::-ms-fill-upper {
      cursor: not-allowed;
    }
  }
}

              
            
!

JS

              
                const color = document.getElementById('color');
const opacity = document.getElementById('opacity');
const img = document.getElementById('img');
const image = document.getElementById('image');

function changeColor() {
  document.body.style.setProperty('--color', color.value);
}

function changeOpacity() {
  document.body.style.setProperty('--opacity', opacity.value);
}

function changeImg() {
  console.log('img');
  image.classList.toggle('hidden');
}
              
            
!
999px

Console