WEBLEB
Home
Editor
Accedi
Pro
Italiano
English
Français
Español
Português
Deutsch
Italiano
हिंदी
cambiare colore
739
mambetov1237.b
Apri nell'Editor
Pubblica il Tuo Codice
Consigliato
16 December 2024
Una home page con il colore Leon
8 February 2025
Cerchio selettore colore
1 December 2024
Colore sfumato al passaggio del mouse
HTML
Copy
HELLO
Bienvenue sur mon site web!
Changer la couleur,
press twice
CSS
Copy
body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column; } h1 { color: white; /* color: #4caf50; */ font-size: 3rem; margin-bottom: 20px; } p { color: white; /* color: #ffd700; */ font-size: 1.5rem; } button { background-color: #4caf50; color: white; border: none; padding: 10px 20px; font-size: 1rem; cursor: pointer; margin-top: 20px; }<!-- Replace with your HTML Code (Leave empty if not needed) -->
JS
Copy
function changeColor() { const body = document.body; const h1 = document.querySelector("h1"); const p = document.querySelector("p"); if (body.style.backgroundColor === "rgb(244, 244, 244)") { body.style.backgroundColor = "#FFD700"; h1.style.color = "#4caf50"; p.style.color = "#4caf50"; } else { body.style.backgroundColor = "#f4f4f4"; h1.style.color = "#white"; p.style.color = "#white"; } }/* Replace with your JS Code (Leave empty if not needed) */