1. Home
  2. /
  3. Tachyons
  4. /
  5. Modal Example

Modal Example - Tachyons Typing CST Test

Loading…

Modal Example — Tachyons Code

Demonstrates a modal popup using Tachyons classes and JavaScript.

<!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://cdnjs.cloudflare.com/ajax/libs/tachyons/4.12.0/tachyons.min.css">
	<title>Tachyons Modal</title>
	<style>.modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); justify-content:center; align-items:center; }
	.modal-content { background:#fff; padding:2rem; border-radius:.5rem; }</style>
</head>
<body class="pa4 tc">
	<button id="open-modal" class="f6 link dim br2 ph3 pv2 dib white bg-blue">Open Modal</button>
	<div id="modal" class="modal flex">
		<div class="modal-content">
		<h3 class="f4">Modal Title</h3>
		<p>This is a Tachyons modal example.</p>
		<button id="close-modal" class="f6 link dim br2 ph3 pv2 dib white bg-red">Close</button>
		</div>
	</div>

	<script>
		document.getElementById('open-modal').onclick = () => document.getElementById('modal').style.display='flex';
		document.getElementById('close-modal').onclick = () => document.getElementById('modal').style.display='none';
	</script>
</body>
</html>

Tachyons Language Guide

Tachyons is a functional CSS framework that emphasizes small, reusable utility classes to build fast, responsive, and highly maintainable user interfaces.

Primary Use Cases

  • ▸Highly optimized and lightweight web pages
  • ▸Performance-focused websites
  • ▸Rapid prototyping using utility classes
  • ▸Responsive design projects without heavy JS
  • ▸Custom UI design without prebuilt components

Notable Features

  • ▸Atomic/utility-first CSS approach
  • ▸Responsive helpers for mobile-first design
  • ▸Lightweight and fast-loading
  • ▸Composable classes for flexible layouts
  • ▸No JS components included

Origin & Creator

Created by Adam Morse in 2013 as a minimalist and performance-focused CSS framework.

Industrial Note

Tachyons is popular in projects prioritizing speed, maintainability, and functional CSS over component-heavy frameworks.

More Tachyons Typing Exercises

Tachyons Counter ExampleTachyons Navbar ExampleTachyons Card ExampleTachyons Tabs ExampleTachyons Accordion ExampleTachyons Slideshow ExampleTachyons Tooltip ExampleTachyons Progress Bar Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher