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

              
                - var images = [
-   { src: "https://picsum.photos/id/1036/1920/700", desc: "Excursions on the mountain" },
-   { src: "https://picsum.photos/id/1015/1920/700", desc: "Sailing on a river" },
-   { src: "https://picsum.photos/id/1016/1920/700", desc: "Caves exploration" },
-   { src: "https://picsum.photos/id/1026/1920/700", desc: "Transportations in a metropolis" },
-   { src: "https://picsum.photos/id/1018/1920/700", desc: "Green island" },
-   { src: "https://picsum.photos/id/1019/1920/700", desc: "Storm" },
-   { src: "https://picsum.photos/id/1021/1920/700", desc: "Fog" },
-   { src: "https://picsum.photos/id/1024/1920/700", desc: "Flying like a bird of prey" },
-   { src: "https://picsum.photos/id/1006/1920/700", desc: "The love of 2 creatures" },
-   { src: "https://picsum.photos/id/1038/1920/700", desc: "The sea waves" }
- ];

section.slider
    .slider__container
        each image in images
            figure
                img(src = image.src, alt = image.desc)
                figcaption= image.desc







<!-- Navigation - Put here because the main code is above -->
<nav class="navigation">
    <a class="navigation__link" href="https://codepen.io/riccardo-andreatta" target="_blank">CodePen</a>
    <a class="navigation__link" href="https://www.linkedin.com/in/riccardoandreatta/?locale=en_US" target="_blank">LinkedIn</a>
    <a class="navigation__link" href="https://github.com/ferie" target="_blank">GitHub</a>
</nav>

              
            
!

CSS

              
                /**
 * Pure CSS slider/carousel with rollback when the animation is finished.
 *
 * It is strongly suggested not to use more than 25 slides.
 * To keep a smooth transition between images use 30 seconds as animation duration and a max of
 * 10 slides in total.
 * 
 * If you feel you need to speed up the slider, try to reduce the `$animation-duration` variable.
 */
$slides-number: 10;
$percentage: 100 / $slides-number;

/**
 * The last transition between the slides is rolling back to the beginning creating a roll back effect.
 * 
 * If you prefer an effect that is continuosly looping through the slides check the following CodePen:
 * https://codepen.io/riccardo-andreatta/full/rNxyYOM
 */
@keyframes slide {
    @for $i from 0 through $slides-number {
        @if $i > 0 and $i <= $slides-number {
            #{($i * $percentage * 1%) - 2%} {
                left: (-100 * ($i - 1) * 1%);
            }
        }
        #{$i * $percentage * 1%} {
            @if $i == $slides-number {
                left: 0%;
            } @else {
                left: (-100 * $i * 1%);
            }
        }
    }
}

.slider {
    font-family: Verdana, Geneva, sans-serif;
    overflow: hidden;
    width: 100%;

    &__container {
        position: relative;
        animation: 30s slide infinite;
        font-size: 0;
        width: 1000%;

        figure {
            display: inline-block;
            width: 10%;
        }

        figcaption { 
            position: absolute;
            bottom: 0;
            background: rgba(0, 0, 0, 0.1);
            font-size: 32px;
            color: #fff;
            padding: 10px 16px;
            text-shadow: 2px 2px 6px #222;
            width: 100%;
        }
    }
}



/* General styles */
body {
    font-family: Verdana, Geneva, sans-serif;
}

/* Navigation Menu */
.navigation {
    position: fixed;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0);
    width: 100%;
    z-index: 2;
    margin-right: 32px;
    text-align: right;
    height: 80px;
    width: auto;

    &__link {
        font-size: 24px;
        color: #fff;
        margin-left: 20px;
        text-decoration: none;
        text-shadow: 0 0 6px #222222;

        &:hover {
            color: #ededed;
            text-shadow: 1px 1px 2px #222222;
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console