css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <!-- MENU -->

<nav class="sample-ctrl">
    <h3>Choose an item</h3>
    <a data-ctrl="jpg" href="#jpg">html (inline-)block</a>
    <a data-ctrl="youtube" href="#youtube">YouTube &lt;iframe&gt;</a>
    <a data-ctrl="vimeo" href="#vimeo">Vimeo &lt;iframe&gt;</a>
    <a data-ctrl="video" href="#video">&lt;video&gt;</a>


<a id="togglescanlines" href="#">Toggle scanlines</a>


<ul class="scanlines">

    <!-- IMG -->
    <li id="jpg"><div class="jpg"></div></li>
    <!-- IFRAME (youtube) -->
    <li id="youtube">
        <iframe id="youTube" src="https://www.youtube.com/embed/KDnfzfBDedE" allowfullscreen></iframe>

    <!-- IFRAME (vimeo) -->
    <li id="vimeo">
        <iframe src="//player.vimeo.com/video/69949278" width="640" height="480" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

    <!-- VIDEO -->
    <li id="video">
        <video controls="controls" loop="loop" poster="http://www.easyhtml5video.com/assets/video/Penguins_of_Madagascar.jpg">
            <source src="http://www.easyhtml5video.com/assets/video/new/Penguins_of_Madagascar.m4v" type="video/mp4">
            <source src="http://www.easyhtml5video.com/assets/video/new/Penguins_of_Madagascar.webm" type="video/webm">
            <source src="http://www.easyhtml5video.com/assets/video/new/Penguins_of_Madagascar.ogv" type="video/ogg">
            <source src="http://www.easyhtml5video.com/assets/video/new/Penguins_of_Madagascar.mp4">
            <param name="allowFullScreen" value="true">
            <img alt="Penguins of Madagascar, trailer 2" src="http://www.easyhtml5video.com/assets/video/Penguins_of_Madagascar.jpg" style="position:absolute;left:0;" width="100%" title="Video playback is not supported by your browser">


// 1. settings: direction of moving scanlines (currently: only bottom to top)
// 2. settings: number of moving scanlines (currently: 0 or 1)
// 3. settings: delay between 2 moving scanlines
// 4. check css validity with keyframes 0% without second step

currently working on :
calculation draft for keyframes steps

$scan-moving-duration: 3s;
$scan-moving-delay: 7s;

total time = 10s (duration + delay)
keyframes :
    0%: wait
    15%: start moving
    85%: end moving & start waiting
    100% : wait

(the rest later)



    // width of 1 scanline (min.: 1px)
    $scan-width: 2px;

    // emulates a damage-your-eyes bad pre-2000 CRT screen ♥ (true, false)
    $scan-crt: true;

    // frames-per-second (should be > 1), only applies if $scan-crt: true;
    $scan-fps: 60;

    // scanline-color (rgba)
    $scan-color: rgba(#000, .3);

    // set z-index on 8, like in ♥ 8-bits ♥, or…
    // set z-index on 2147483648 or more to enable scanlines on Chrome fullscreen (doesn't work in Firefox or IE);
    $scan-z-index: 2147483648; 


    // moving scanline (true, false)
    $scan-moving-line: true;

    // opacity of the moving scanline
    $scan-opacity: .75;

/* MIXINS */

    // apply CRT animation: @include scan-crt($scan-crt);
    @mixin scan-crt($scan-crt) {
        @if $scan-crt == true {
            animation: scanlines 1s steps($scan-fps) infinite;
        @else { animation: none; }

    // apply CRT animation: @include scan-crt($scan-crt);
    @mixin scan-moving($scan-moving-line) {
        @if $scan-moving-line == true {
            animation: scanline 6s linear infinite;
        @else { animation: none; }

/* CSS .scanlines CLASS */

    .scanlines {
        position: relative;
        overflow: hidden; // only to animate the unique scanline

        &:after {
            display: block;
            pointer-events: none;
            content: '';
            position: absolute;

        // unique scanline travelling on the screen
        &:before {
            // position: absolute;
            // bottom: 100%;
            width: 100%;
            height: $scan-width * 1;
            z-index: $scan-z-index + 1;
            background: $scan-color;
            opacity: $scan-opacity;
            // animation: scanline 6s linear infinite;
            @include scan-moving($scan-moving-line);

        // the scanlines, so!
        &:after {
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: $scan-z-index;
            background: linear-gradient(
                to bottom,
                transparent 50%,
                $scan-color 51%
            background-size: 100% $scan-width*2;
            @include scan-crt($scan-crt);

    @keyframes scanline {
        0% {
            transform: translate3d(0,200000%,0);
            // bottom: 0%; // to have a continuous scanline move, use this line (here in 0% step) instead of transform and write, in &:before, { position: absolute; bottom: 100%; }

    @keyframes scanlines {
        0% {
            background-position: 0 50%;
            // bottom: 0%; // to have a continuous scanline move, use this line (here in 0% step) instead of transform and write, in &:before, { position: absolute; bottom: 100%; }


a {
    display: block;
    padding: 1em;
    margin: 0 auto;
    width: 80%;
    color: rgba(#fff, .5);
    text-transform: uppercase;
    text-decoration: none;
    background: rgba(#000, .8);
    border: 1px solid rgba(#fff, .5);

    &#togglescanlines {
        position: absolute;
        width: 182px;
        top: 300px;
        right: 58px;
        border-width: 10px;
        background: rgba(#000, .4);
    &:hover {
        color: #fff;

nav {
    float: right;
    width: 350px;
    text-align: center;

ul {
    display: inline-block;
    margin: 0;
    list-style-type: none;
    padding: 0;

    &.scanlines {
        position: absolute;
    .jpg {
        width: calc(100vw - 350px);
        height: 95vh;
        border: none;
    li {
/*        display: none;

        &:target {
            display: inline-block;

.jpg {
    background: url('http://images.eurogamer.net/articles//a/6/4/8/8/1/7/PC_003.jpg.jpg.jpg') no-repeat;
    background-size: cover;

body {
    position: relative;
    background: #1b1b1b;
    color: #c8c8c8;
    text-shadow: 2px 2px 2px #333;

var $scanlines = $('.scanlines');

// toggle scanlines
$('#togglescanlines').on('click', function(e) {

// switch between demos
$('.sample-ctrl a').on('click', function(e) {
       .filter('#'+ $(this).attr('data-ctrl')).show();
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................