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 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.

Quick-add: + add another resource

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.

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="container">

	<span class="js-typed-src">
		<h1 class="page-title">Hey, this is typed using <a href="https://github.com/mattboldt/typed.js/">Typed.js</a>!</h1>
	<span class="js-typed"></span>

	<span class="js-typed-src">
		<h2>I wanted to type out an entire page of text rather than a single line which is how it is usually used.</h2>
	<span class="js-typed"></span>

	<span class="js-typed-src" data-speed="20">
		<p>I figured out a way to cycle through an array of elements and apply a new Typed instance to each one using a recursive function. This section is typed faster because of a data attribute used to apply a different typing speed per section.</p>
		<img class="page-image" src="http://3.bp.blogspot.com/-DT6OM3ShPZk/VGmsJb1hCkI/AAAAAAAARm0/JxQao_QFhGs/s1600/caloria.jpg">
		<p>You'll notice there are a few paragraph tags in this section, and even an image! The plugin is moving through all of this text and doesn't care about the markup.</p>
		<p>All of the text already exists in an element with the class <code>.js-typed-src</code> that is visually hidden. Then, there is an empty <code>&lt;span></code> below each with the class <code>.js-typed</code>. The plugin retrieves the HTML from the aforementioned <code>.js-typed-src</code> element and types it into the empty <code>span.js-typed</code>. This flow could probably be improved, plus it <em>may</em> read twice for screen readers &dash; I still have to test that.</p>
	<span class="js-typed"></span>
	<span class="js-typed-src">
		<p>Anyhow, I'm finally learning JavaScript...for real this time!</p>
	<span class="js-typed"></span>

              * {
	box-sizing: border-box;

body {
	line-height: 1.4;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

a {
	color: skyblue;
	text-decoration: none;
	&:hover {
		color: lightslategray;

img {
	max-width: 100%;
	height: auto;

// Hidden for accessibility
.js-typed-src {
	opacity: 0;
	position: absolute;
	left: -99999px;

.container {
	max-width: 600px;
	margin: 2rem auto;
	padding: 1rem;

.page-title {
	margin-top: 0;

.page-image {
	display: block;
	margin: 1rem auto;
              // Get an array of all elements to be typed.
const TYPED_SRCS = document.querySelectorAll('.js-typed-src');
const TYPED_ELS = document.querySelectorAll('.js-typed');
const TYPE_SPEED = 40,
			SHOW_CURSOR = false;

var options = {
	elIndex: 0,
	strings: [TYPED_SRCS[0].innerHTML],
	typeSpeed: TYPE_SPEED,
	showCursor: SHOW_CURSOR,
	onComplete: () => {

// Start the typing elements, starting with index 0
var typed = new Typed(TYPED_ELS[0], options);

// Function to type next item in typedEls array
function typeNextInArray() {

	// Move through the array
	let newIndex = options.elIndex;
	let currentEl = TYPED_SRCS[newIndex];

	// Allow for data attributes to provide some settings
	let newTypeSpeed = "speed" in currentEl.dataset ? +currentEl.dataset.speed : TYPE_SPEED;
	// More options could be added to / retrieved via data attributes here!

	// New options set
	let newOptions = {
		elIndex: newIndex,
		startDelay: 500,
		strings: [TYPED_SRCS[newIndex].innerHTML],
		typeSpeed: newTypeSpeed,
		showCursor: SHOW_CURSOR,
		onComplete: () => {
			if (newIndex + 1 <= TYPED_ELS.length - 1) {
				return typeNextInArray();
			} else {

	let typed = new Typed(TYPED_ELS[newIndex], newOptions);
Loading ..................