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

+ add another resource


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


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.


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.


                <div id="outer-div">
	<p id="demo">Rainbow!</p>
<div id="button"><span>Animate</span></div>
<input oninput="updateInner()" placeholder="TEXT TO ANIMATE"></input>


                @import url('');

html {
	background-color: black;

body {
	width: 100%;
	height: 100%

#demo {
	text-transform: uppercase;
	font-family: Lato;
	font-size: 100px;
	color: black;
	margin: 0;
	border-bottom: 1px solid white

#demo span {
	display: inline-block

.animated {
	animation: customRainbow 4s infinite;
	transition-timing-function: linear;

.text {

@keyframes customRainbow {
    0%   { text-shadow: 0px 0px 5px red; }
    14%  { text-shadow: 0px 0px 5px orange; }
    28%  { text-shadow: 0px 0px 5px yellow; -webkit-transform: translatey(-25px)}
    43%  { text-shadow: 0px 0px 5px green; }
    57% { text-shadow: 0px 0px 5px blue; }
	71% { text-shadow: 0px 0px 5px indigo; }
	85% { text-shadow: 0px 0px 5px violet; }
	100% { text-shadow: 0px 0px 5px red; }

#button {
	font-weight: bold;
	padding: 1px;
	background-color: black;
	border: 2px solid white;
	border-radius: 10px;
	color: white;
	width: 100px;
	height: 30px;
	text-align: center;
	vertical-align: middle;
	-webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
	user-select: none;
	position: absolute;
	left: 50%;
	bottom: 20%;
	cursor: pointer;

input {
	position: absolute;
	left: 47.5%;
	background: black;
	color: white;

#outer-div {
	position: absolute;
	top: 40%;
	width: 100%;
	margin: 0


                const textElement = document.getElementById('demo');
const textInput = document.querySelector('input')

function animate() {
	var text = textElement.innerHTML;
	text = text.replace(" ", "_")
	var len = text.length
	var wrapped = "";
	for (var i in text) {
		wrapped += '<span>' + text.charAt(i) + '</span>';
	textElement.innerHTML = wrapped
	var delay = 0
	for (var i = 0; i < len; i++) {
		var childQuery = "#demo span:nth-child(" + (i + 1) + ")"
		document.querySelector(childQuery).style.animationDelay = delay + "s";
		delay += 0.25

	document.querySelectorAll('#demo span').forEach(span => span.classList.add('animated'))

document.getElementById('button').addEventListener('click', function() {
	if(textInput.value === "") {
		textElement.innerHTML = ""

function updateInner() {
	textElement.innerHTML = textInput.value