HTML arka plan renk değiştirme (basit eğlenceli)

SizinSesiniz

~~Şimdi Susma Vakti~~
Özel üye
Kod:
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Renk Değiştirici</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f4f4f4;
        }
        .container {
            text-align: center;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            margin-top: 20px;
        }
    </style>
</head>
<body>

<div class="container">
    <h1>Arka Plan Rengini Değiştir</h1>
    <button onclick="changeColor()">Renk Değiştir</button>
</div>

<script>
    function changeColor() {
        var colors = ['#3498db', '#e74c3c', '#2ecc71', '#f1c40f', '#9b59b6'];
        var randomColor = colors[Math.floor(Math.random() * colors.length)];
        document.body.style.backgroundColor = randomColor;
    }
</script>

</body>
</html>
 
Geri
Top