summaryrefslogtreecommitdiff
path: root/tailwindcss/02-vite/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'tailwindcss/02-vite/index.html')
-rw-r--r--tailwindcss/02-vite/index.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/tailwindcss/02-vite/index.html b/tailwindcss/02-vite/index.html
index 8107c39..f44f5a1 100644
--- a/tailwindcss/02-vite/index.html
+++ b/tailwindcss/02-vite/index.html
@@ -6,6 +6,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/src/style.css" rel="stylesheet">
<title>Tailwind CSS Starter</title>
+
+ <!-- Prevent screen flashing on initial load -->
+ <script>
+ if (localStorage.getItem('theme') === 'dark' ||
+ (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
+ document.documentElement.classList.add('dark');
+ } else {
+ document.documentElement.classList.remove('dark');
+ }
+ </script>
</head>
<body class="transition-colors duration-300">
@@ -16,6 +26,7 @@
<a href="#">Home</a>
<a href="#">Blog</a>
<a href="#">Contact</a>
+ <a href="#" id="theme-toggle">Toggle Theme</a>
</nav>
</div>
@@ -71,6 +82,7 @@
&copy; 2026 My Website. All rights reserved.
</footer>
</div>
+ <script src="/src/main.js"></script>
</body>
</html> \ No newline at end of file