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.


			<h1>Animated Counter</h1>
		<section class="counters">
			<div class="container">
					<i class="fab fa-youtube fa-4x"></i>
					<div class="counter" data-target="60000">0</div>
					<i class="fab fa-twitter fa-4x"></i>
					<div class="counter" data-target="15000">0</div>
					<i class="fab fa-facebook fa-4x"></i>
					<div class="counter" data-target="9000">0</div>
					<i class="fab fa-linkedin fa-4x"></i>
					<div class="counter" data-target="5000">0</div>


                @import url('');

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;

body {
	font-family: 'Roboto', sans-serif;
	background: lightskyblue
	color: #fff;
	/* Push to bottom */
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 100vh;

.container {
	max-width: 1100px;
	margin: 0 auto;
	overflow: auto;

header {
	flex: 1;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;

header h1 {
	font-size: 60px;

.counters {
	background: #0f479a;
	color: #fff;
	padding: 40px 20px;
	border-top: 3px lightskyblue solid;

.counters .container {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-gap: 30px;
	text-align: center;

.counters i {
	color: lightskyblue;
	margin-bottom: 5px;

.counters .counter {
	font-size: 45px;
	margin: 10px 0;

@media (max-width: 700px) {
	.counters .container {
		grid-template-columns: repeat(2, 1fr);

	.counters .container > div:nth-of-type(1),
	.counters .container > div:nth-of-type(2) {
		border-bottom: 1px lightskyblue solid;
		padding-bottom: 20px;



                const counters = document.querySelectorAll('.counter');
const speed = 200; // The lower the slower

counters.forEach(counter => {
	const updateCount = () => {
		const target = +counter.getAttribute('data-target');
		const count = +counter.innerText;

		// Lower inc to slow and higher to slow
		const inc = target / speed;

		// console.log(inc);
		// console.log(count);

		// Check if target is reached
		if (count < target) {
			// Add inc to count and output in counter
			counter.innerText = count + inc;
			// Call function every ms
			setTimeout(updateCount, 1);
		} else {
			counter.innerText = target;