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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <p>
  Shall we play a game?
</p>

<p class="typing" id="Type">
  &gt; Let's be accessible.
<!--   <br>&gt; 10 print "Hey there" -->
</p>

<button type="button" onclick="Delete();">Delete</button>
<button type="button" onclick="Retype();">Retype</button>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=VT323&display=swap");

:root {
  --CRT: rgba(0, 255, 0, 0.7);
  --CRT-shadow: rgba(0, 168, 0, 0.2);
/*   --CRT: rgba(255, 176, 0, 0.8);
  --CRT-shadow: rgb(185, 128, 0, 0.2); */
}

body {
  font-family: "VT323", "Courier New", Courier, monospace;
  font-variant-ligatures: none;
  line-height: 1.4;
  margin: 0.5em 1em;
  /*     line-height: 1.5; */
  /*     letter-spacing: 0.12em; */
  /*     word-spacing: 0.16em; */
  color: var(--CRT);
  text-shadow: var(--CRT-shadow) 0.5em 0 0.2em;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    ),
    linear-gradient(to bottom, #222, #222 50%, #000 50%, #000);
  background-size: 100% 4px, 6px 100%, 100% 2px;
  background-position: 0 0, 0 0, 0 0;
}

@keyframes flicker {
  from {
    background-position: 0 0, 0 0, 0 0;
  }
  50% {
    background-position: 0 2px, 1px 0, 0 0;
  }
  to {
    background-position: 0 0, 0 0, 0 0;
  }
}

button {
  font: inherit;
  color: #000;
  background-color: var(--CRT);
  border: 0.1em solid transparent;
  font-size: 150%;
}

button:focus,
button:hover {
  outline: 0.1em solid var(--CRT);
  outline-offset: 0.1em;
}

p {
  font-size: 200%;
  line-height: 0.9;
}

p.typing {
  width: max-content;
  text-shadow: none;
  color: transparent;
  position: relative;
  background-color: transparent;
  background: linear-gradient(
      to right,
      var(--CRT) 0,
      var(--CRT) 9%,
      transparent 9%,
      transparent 100%
    ),
    transparent;
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  animation: 4s ease-in-out 1.5s 1 forwards type;
}

p.typing::first-letter {
  text-shadow: var(--CRT-shadow) 0.5em 0 0.2em;
}

p.typing::after {
  content: "\00a0";
  width: calc(100% - 2ch);
  position: absolute;
  top: 0;
  left: 2ch;
  background-color: transparent;
  background: linear-gradient(
      to right,
      var(--CRT) 0,
      var(--CRT) 0.2ch,
      transparent 0.2ch,
      transparent 100%
    ),
    transparent;  
}

p.deleting {
  animation: 2s ease-in 0.5s 1 reverse both type;
}

p.typing::after {
  animation: 4s ease-in-out 1.5s 1 forwards cursorMove;
}

p.deleting::after {
  animation: 2s ease-in 0.5s 1 reverse both cursorMove;
}


@media screen and (prefers-reduced-motion: no-preference) {
  body {
    animation: flicker .25s linear infinite;
  }
  
  p.typing::after {
    animation: 4s ease-in-out 1.5s 1 forwards cursorMove,
    0.4s linear infinite alternate cursorBlink;
  }

  p.deleting::after {
    animation: 2s ease-in 0.5s 1 reverse both cursorMove,
      0.4s linear infinite alternate cursorBlink;
  }
}

@keyframes cursorBlink {
  from {
    content: "\00a0";
  }
  to {
    content: "";
  }
}

@keyframes cursorMove {
  from {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 0.2ch,
        transparent 0.2ch,
        transparent 100%
      ),
      transparent;
  }
  5% {
    background: linear-gradient(
        to right,
        transparent 5%,
        var(--CRT) 5%,
        var(--CRT) calc(5% + 0.2ch),
        transparent calc(5% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  10% {
    background: linear-gradient(
        to right,
        transparent 10%,
        var(--CRT) 10%,
        var(--CRT) calc(10% + 0.2ch),
        transparent calc(10% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  15% {
    background: linear-gradient(
        to right,
        transparent 15%,
        var(--CRT) 15%,
        var(--CRT) calc(15% + 0.2ch),
        transparent calc(15% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  20% {
    background: linear-gradient(
        to right,
        transparent 20%,
        var(--CRT) 20%,
        var(--CRT) calc(20% + 0.2ch),
        transparent calc(20% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  25% {
    background: linear-gradient(
        to right,
        transparent 25%,
        var(--CRT) 25%,
        var(--CRT) calc(25% + 0.2ch),
        transparent calc(25% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  30% {
    background: linear-gradient(
        to right,
        transparent 30%,
        var(--CRT) 30%,
        var(--CRT) calc(30% + 0.2ch),
        transparent calc(30% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  35% {
    background: linear-gradient(
        to right,
        transparent 35%,
        var(--CRT) 35%,
        var(--CRT) calc(35% + 0.2ch),
        transparent calc(35% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  40% {
    background: linear-gradient(
        to right,
        transparent 40%,
        var(--CRT) 40%,
        var(--CRT) calc(40% + 0.2ch),
        transparent calc(40% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  45% {
    background: linear-gradient(
        to right,
        transparent 45%,
        var(--CRT) 45%,
        var(--CRT) calc(45% + 0.2ch),
        transparent calc(45% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  50% {
    background: linear-gradient(
        to right,
        transparent 50%,
        var(--CRT) 50%,
        var(--CRT) calc(50% + 0.2ch),
        transparent calc(50% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  55% {
    background: linear-gradient(
        to right,
        transparent 55%,
        var(--CRT) 55%,
        var(--CRT) calc(55% + 0.2ch),
        transparent calc(55% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  60% {
    background: linear-gradient(
        to right,
        transparent 60%,
        var(--CRT) 60%,
        var(--CRT) calc(60% + 0.2ch),
        transparent calc(60% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  65% {
    background: linear-gradient(
        to right,
        transparent 65%,
        var(--CRT) 65%,
        var(--CRT) calc(65% + 0.2ch),
        transparent calc(65% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  70% {
    background: linear-gradient(
        to right,
        transparent 70%,
        var(--CRT) 70%,
        var(--CRT) calc(70% + 0.2ch),
        transparent calc(70% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  75% {
    background: linear-gradient(
        to right,
        transparent 75%,
        var(--CRT) 75%,
        var(--CRT) calc(75% + 0.2ch),
        transparent calc(75% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  80% {
    background: linear-gradient(
        to right,
        transparent 80%,
        var(--CRT) 80%,
        var(--CRT) calc(80% + 0.2ch),
        transparent calc(80% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  85% {
    background: linear-gradient(
        to right,
        transparent 85%,
        var(--CRT) 85%,
        var(--CRT) calc(85% + 0.2ch),
        transparent calc(85% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  90% {
    background: linear-gradient(
        to right,
        transparent 90%,
        var(--CRT) 90%,
        var(--CRT) calc(90% + 0.2ch),
        transparent calc(90% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  95% {
    background: linear-gradient(
        to right,
        transparent 95%,
        var(--CRT) 95%,
        var(--CRT) calc(95% + 0.2ch),
        transparent calc(95% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
  to {
    background: linear-gradient(
        to right,
        transparent 99%,
        var(--CRT) 99%,
        var(--CRT) calc(99% + 0.2ch),
        transparent calc(99% + 0.2ch),
        transparent 100%
      ),
      transparent;
  }
}

@keyframes type {
  from {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 9%,
        transparent 9%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  5% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 13.5%,
        transparent 13.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  10% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 18%,
        transparent 18%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  15% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 22.5%,
        transparent 22.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  20% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 27%,
        transparent 27%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  25% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 31.5%,
        transparent 31.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  30% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 36%,
        transparent 36%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  35% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 40.5%,
        transparent 40.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  40% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 45%,
        transparent 45%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  45% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 49.5%,
        transparent 49.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  50% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 54%,
        transparent 54%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  55% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 58.5%,
        transparent 58.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  60% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 63%,
        transparent 63%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  65% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 67.5%,
        transparent 67.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  70% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 72%,
        transparent 72%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  75% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 76.5%,
        transparent 76.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  80% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 81%,
        transparent 81%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  85% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 85.5%,
        transparent 85.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  90% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 90%,
        transparent 90%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  95% {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 94.5%,
        transparent 94.5%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
  to {
    background: linear-gradient(
        to right,
        var(--CRT) 0,
        var(--CRT) 100%,
        transparent 100%,
        transparent 100%
      ),
      transparent;
    background-clip: text;
    -webkit-background-clip: text;
  }
}

              
            
!

JS

              
                function Delete() {
  var compType = document.getElementById('Type');
  compType.classList.remove('typing');
  setTimeout(function () {
    compType.classList.add('typing');
    compType.classList.add('deleting');
  }, 0);
}

function Retype() {
  var compType = document.getElementById('Type');
  compType.classList.remove('typing');
  compType.classList.remove('deleting');
  setTimeout(function () {
    compType.classList.add('typing');
  }, 0);
}
              
            
!
999px

Console