cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="tv">
    <div class="white"></div>
    <div id="term"></div>
    <div class="scanlines"></div>
</div>
            
          
!
            
              /*
 * style based on http://js13kgames.com/entries/lost-in-cyberspace
 */
body {
    margin: 0;
}
#term {
    height: 100vh;
    --background: #031e11;
    --size: 1.5;
}
/*
 * reference: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within
 */
.cmd:focus-within .prompt {
    color: red;
}
.terminal {
    text-shadow: 0 0.2rem 1rem #0c7b46;
}
.terminal a:hover {
    background: #0F60FF;
    color: var(--background, #aaa);
    text-decoration: none;
}
.scanlines {
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,.2) 70%,
        rgba(0,0,0,.6)
    );
    background-size: 100% .3rem;
    position: fixed;
    pointer-events: none;
}
/* based on
https://blog.carbonfive.com/2015/01/07/vintage-terminal-effect-in-css3/
*/
.scanlines:before {
  position: absolute;
  top: 0px;
  width: 100%;
  height: 5px;
  background: #fff;
  background: linear-gradient(to bottom,
      rgba(255,0,0,0) 0%,
      rgba(255,250,250,1) 50%,
      rgba(255,255,255,0.98) 51%,
      rgba(255,0,0,0) 100%
  ); /* W3C */
  opacity: .1;
}
.scanlines:after {
  box-shadow: 0 2px 6px rgba(25,25,25,0.2),
      inset 0 1px rgba(50,50,50,0.1),
      inset 0 3px rgba(50,50,50,0.05),
      inset 0 3px 8px rgba(64,64,64,0.05),
      inset 0 -5px 10px rgba(25,25,25,0.1);
}

#term:focus-within + .scanlines:before {
  content: '';
  animation: vline calc(var(--time, 2) * 1s) linear infinite;
}
@keyframes vline {
  to { transform: translate(0, 100vh)}
}
/* turn off animation */
.tv {
    height: 100vh;
    position: relative;
}
.white {
    content: '';
    display: block;
    height: 100%;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: white;
    z-index: 1;
    opacity: 0;
    animation: opacity 5s ease-out infinite;
    animation-fill-mode: forwards;
}

@keyframes opacity {
    0%: { opacity: 0.1 }
    100%: { opacity: 1; }
}
            
          
!
            
              // for browsers that don't support key property
keyboardeventKeyPolyfill.polyfill();
var scanlines = $('.scanlines');
var term = $('#term').terminal(function(command, term) {
    if (command.match(/^\s*exit\s*$/)) {
        $('.tv').addClass('collapse');
        term.disable();
    } else if (command !== '') {
        try {
            var result = window.eval(command);
            if (result !== undefined) {
                term.echo(new String(result));
            }
        } catch(e) {
            term.error(new String(e));
        }
    } else {
        term.echo('');
    }
}, {
    name: 'js_demo',
    onResize: set_time,
    exit: false,
    onInit: set_time,
    prompt: 'js> '
});
function set_time() {
    // for window heihgt of 170 it should be 2s
    var time = ($(window).height() * 2) / 170;
    scanlines[0].style.setProperty("--time", time);
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console