1. Home
  2. /
  3. Foundation
  4. /
  5. Counter Example

Counter Example - Foundation Typing CST Test

Loading…

Counter Example — Foundation Code

Demonstrates a simple counter layout using Foundation classes and minimal JavaScript for interactivity.

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.5/dist/css/foundation.min.css">
	<title>Foundation Counter</title>
</head>
<body>
	<div class="grid-container text-center" id="container">
		<h2>Counter: <span id="count">0</span></h2>
		<div class="button-group">
		<button id="increment" class="button">+</button>
		<button id="decrement" class="button alert">-</button>
		<button id="reset" class="button secondary">Reset</button>
		</div>
		<button id="theme-btn" class="button warning">Switch Theme</button>
	</div>

	<script>
		let count = 0;
		let isDark = false;
		const countEl = document.getElementById('count');
		const container = document.getElementById('container');
		document.getElementById('increment').onclick = () => { count++; countEl.textContent = count; };
		document.getElementById('decrement').onclick = () => { count--; countEl.textContent = count; };
		document.getElementById('reset').onclick = () => { count = 0; countEl.textContent = count; };
		document.getElementById('theme-btn').onclick = () => {
		isDark = !isDark;
		container.classList.toggle('dark-theme', isDark);
		container.classList.toggle('text-white', isDark);
		container.classList.toggle('light-theme', !isDark);
		container.classList.toggle('text-black', !isDark);
		};
	</script>

	<style>
		.dark-theme { background-color: #222; color: #eee; }
		.light-theme { background-color: #fff; color: #000; }
	</style>
</body>
</html>

Foundation Language Guide

Foundation is a responsive front-end framework that provides a mobile-first grid system, prebuilt UI components, and flexible styling utilities. It is designed to speed up development while maintaining accessibility and consistency.

Primary Use Cases

  • ▸Responsive web apps
  • ▸Corporate websites
  • ▸Prototyping and MVPs
  • ▸Design systems and UI kits
  • ▸Accessible front-end development

Notable Features

  • ▸Mobile-first responsive grid
  • ▸Prebuilt UI components (buttons, forms, modals)
  • ▸Sass-based customization
  • ▸Accessibility-ready components
  • ▸Built-in JavaScript plugins

Origin & Creator

Created by ZURB in 2011 as a professional-grade front-end framework for rapid prototyping and production-ready websites.

Industrial Note

Foundation is ideal for teams needing accessible, responsive, and enterprise-ready front-end frameworks, especially in complex web applications and rapid prototyping environments.

More Foundation Typing Exercises

Foundation Callout ExampleFoundation Top Bar ExampleFoundation Card ExampleFoundation Accordion ExampleFoundation Reveal Modal ExampleFoundation Tabs ExampleFoundation Form ExampleFoundation Table Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher