Html Css Javascript - Crash Course

🎯 Goal Build a dynamic "Theme Switcher" page that changes colors when you click a button. 1. HTML (Structure) HTML defines the content and layout.

// script.js const button = document.getElementById('themeBtn'); const body = document.body; // Check localStorage for saved preference const savedTheme = localStorage.getItem('theme'); if (savedTheme === 'dark') body.classList.add('dark'); button.textContent = '☀️ Light Mode'; html css javascript crash course

// Toggle theme on button click button.addEventListener('click', () => body.classList.toggle('dark'); 🎯 Goal Build a dynamic "Theme Switcher" page