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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!-- HEADING -->
<!-- ========================================================================== -->
<h1>CSS Carousel/Slider</h1>

<!-- MAIN -->
<!-- ========================================================================== -->
<div class="c">

  <input type="radio" name="a" id="cr-1" checked>
  <label for="cr-1" style="--hue: 32"></label>
  <div class="ci" style="--z: 4">
    <h2 class="ch" style="--h: 32; --s: 80%; --l: 90%">What do you know?</h2>
    <img src="https://images.unsplash.com/photo-1516655802732-dc776050098b?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=eyJhcHBfaWQiOjF9&ixlib=rb-1.2.1&q=80&w=700" alt="Snow on leafs">
  </div>

  <input type="radio" name="a" id="cr-2">
  <label for="cr-2" style="--hue: 82"></label>
  <div class="ci" style="--z: 3">
    <h2 class="ch" style="--h: 82; --s: 80%; --l: 90%">Look from inside?</h2>
    <img src="https://images.unsplash.com/photo-1529761430595-036b79cb9d5e?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=eyJhcHBfaWQiOjF9&ixlib=rb-1.2.1&q=80&w=700" alt="Trees">
  </div>

  <input type="radio" name="a" id="cr-3">
  <label for="cr-3" style="--hue: 40"></label>
  <div class="ci" style="--z: 2">
    <h2 class="ch" style="--h: 40; --s: 100%; --l: 89%">In the mountains?</h2>
    <img src="https://images.unsplash.com/photo-1518805629729-3e55b81b2393?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=eyJhcHBfaWQiOjF9&ixlib=rb-1.2.1&q=80&w=700" alt="Mountains and houses">
  </div>

  <input type="radio" name="a" id="cr-4">
  <label for="cr-4" style="--hue: 210"></label>
  <div class="ci" style="--z: 1">
    <h2 class="ch" style="--h: 210; --s: 70%; --l: 90%">Above looks beautiful?</h2>
    <img src="https://images.unsplash.com/photo-1488831948116-38bc1351c6d6?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=eyJhcHBfaWQiOjF9&ixlib=rb-1.2.1&q=80&w=700" alt="Sky and mountains">
  </div>

</div>

<!-- ABS -->
<!-- ========================================================================== -->
<a href="https://abubakersaeed.netlify.app" class="abs-site-link" rel="nofollow noreferrer" target="_blank">abs.</a>

<div class="abs-profiles">
  <a href="https://dribbble.com/AbubakerSaeed" rel="nofollow noreferrer" target="_blank">
    <img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" style="max-width: 24px">
  </a>

  <a href="https://twitter.com/AbubakerSaeed96" rel="nofollow noreferrer" target="_blank">
    <svg viewBox="0 0 32 32" height="24px">
      <path fill="hsl(32 50% 50%)" d="M32 7.075c-1.175 0.525-2.444 0.875-3.769 1.031 1.356-0.813 2.394-2.1 2.887-3.631-1.269 0.75-2.675 1.3-4.169 1.594-1.2-1.275-2.906-2.069-4.794-2.069-3.625 0-6.563 2.938-6.563 6.563 0 0.512 0.056 1.012 0.169 1.494-5.456-0.275-10.294-2.888-13.531-6.862-0.563 0.969-0.887 2.1-0.887 3.3 0 2.275 1.156 4.287 2.919 5.463-1.075-0.031-2.087-0.331-2.975-0.819 0 0.025 0 0.056 0 0.081 0 3.181 2.263 5.838 5.269 6.437-0.55 0.15-1.131 0.231-1.731 0.231-0.425 0-0.831-0.044-1.237-0.119 0.838 2.606 3.263 4.506 6.131 4.563-2.25 1.762-5.075 2.813-8.156 2.813-0.531 0-1.050-0.031-1.569-0.094 2.913 1.869 6.362 2.95 10.069 2.95 12.075 0 18.681-10.006 18.681-18.681 0-0.287-0.006-0.569-0.019-0.85 1.281-0.919 2.394-2.075 3.275-3.394z"></path>
    </svg>
  </a>
</div>
              
            
!

CSS

              
                /*
    ================================
        Best Viewed In Full Page
https://codepen.io/AbubakerSaeed/pen/QWjYYmB
    ================================
*/

/* Change slides by clicking on those grayish lines using mouse, can use keyboard arrows too :) */

/* It's not responsive, so check it out in big/large screen */

/* FONT */
/* ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@700&display=swap');


/* DEFAULTS */
/* ========================================================================== */
body {
  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 100vh;
  margin: 0;

  background: hsl(0 0% 98%);
  font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Open Sans', sans-serif;
}

h1 {
  color: hsla(32 50% 50% / .8);

  position: fixed;
  left: -100px;
  top: 50%;
  margin: 0;

  transform: rotate(-90deg) translateY(-50%);
}


/* C */
/* ========================================================================== */
.c {
  min-width: 700px;
  width: 700px;
  height: 500px;
  border-radius: 12px;
  padding: 20px;
  padding-bottom: 40px;
  box-shadow: 0 8px 48px 2px hsla(10 6% 15% / .4);

  display: flex;
  align-items: flex-end;
  justify-content: center;

  position: relative;
  overflow: hidden;
  background: hsl(0 0% 90%);

  box-sizing: border-box;
}

.ci {
  position: absolute;
  top: 0;
  left: 0;

  width: inherit;
  height: inherit;
  transform-origin: left 50%;

  background: inherit;

  z-index: var(--z);
  transition: .3s ease-out;
}

.ci img {
  -moz-user-select: none;
  user-select: none;
}

.ch {
  position: absolute;
  top: 70%;
  left: 4%;
  transform: translateY(-50%);

  font-size: 2rem;
  color: hsla(var(--h) var(--s) var(--l) / .8);
  text-shadow: 0 2px 10px hsla(var(--h) var(--s) 10% / .3);
}

input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  z-index: -10;
}

label {
  width: 10%;
  height: 10px;
  margin-right: 4px;
  border-radius: 20px;

  background: hsla(0 0% 90% / .3);
  cursor: pointer;

  position: relative;
  z-index: 10;
}

label:last-child {
  margin-right: 0;
}

input:checked+label {
  background: linear-gradient(to right,
    hsla(var(--hue) 80% 70% / .7),
    hsla(calc(var(--hue) + 30) 80% 50% / .7));
}

input:not(:checked)+label+.ci {
  transform: translateX(-100%);
  opacity: 0;
}

input:checked+label+.ci~.ci {
  transform: translateX(100%);
}

input:not(:checked)+label+.ci {
  transition: 0;
}


/* ABS */
/* ========================================================================== */
.abs-site-link {
  position: fixed;
  z-index: 11;
  bottom: 20px;
  left: 20px;
  color: hsla(32 50% 50% / .8);
  font-size: 1.6rem;
  font-weight: bold;
  border-bottom: 3px solid currentColor;
  text-decoration: none;
  background-color: inherit;
}

.abs-profiles {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: 23px;
  opacity: .8;
}

.abs-profiles img {
  filter: hue-rotate(71deg) brightness(1.1);
}

.abs-profiles a {
  display: inline-block;
  margin-left: 6px;
}
              
            
!

JS

              
                // by
// @AbubakerSaeed96
// abubakersaeed.netlify.app

// And the journey to CSS only components continues...

/*
  In this one I'm using CSS selectors and little hack/tricks to archive proper sliding effect between slides, the old one would be something like this when you change the slide:
  the 1st one goes backward(left) and the 2nd one comes forward(center) and if you change it to 3rd...
  the 2nd one goes backward(left) and the 3rd one comes forward(center) and so on...
*/

/*
  It makes sliding weird and most of the times we've to use JavaScript to archive proper sliding, so I start experimenting and is able to archive proper sliding effect with CSS only :)
*/

/*
  Images are from Unsplash 
*/

// Thanks for viewing
              
            
!
999px

Console