HOME > ARTICLES > CSS TERMINAL EFFECTS WITHOUT JAVASCRIPT

CSS TERMINAL EFFECTS WITHOUT JAVASCRIPT

[2023.11.05]  06_MIN_READ

Pure CSS CRT Aesthetics

Building terminal-style interfaces doesn’t require JavaScript. CSS has everything needed for scanlines, cursor blinks, and glitch effects.

Scanlines

The repeating-linear-gradient function creates CRT scanline overlays:

.scanlines {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
}

Apply it as an absolutely positioned overlay on top of content.

Blinking Cursor

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.cursor::after {
  content: '▌';
  animation: blink 1s step-end infinite;
}

The step-end timing function creates the hard on/off blink characteristic of real terminals.

Viewfinder Brackets

.bracket-tl {
  position: absolute;
  top: 0; left: 0;
  width: 20px; height: 20px;
  border-top: 2px solid white;
  border-left: 2px solid white;
}

Barcode Decoration

.barcode {
  background: repeating-linear-gradient(
    to right,
    white 0px, white 2px,
    transparent 2px, transparent 6px
  );
  height: 20px;
  width: 120px;
}

Conclusion

CSS-only terminal effects are performant, accessible, and work without any JavaScript runtime. They degrade gracefully when CSS is unavailable.

< /articles