Buttons HTML
Buttons HTML
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website with Buttons</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
</header>
<div class="button-container">
<button id="alertButton">Click Me for Alert</button>
<button id="colorButton">Change Background Color</button>
<button id="navigateButton">Go to Google</button>
</div>
<script src="script.js"></script>
</body>
</html>
/* General body styles */
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
background-color: #f0f0f0;
margin: 0;
}
/* Header style */
header h1 {
color: #333;
}
/* Button container */
.button-container {
margin-top: 30px;
}
/* Button styles */
button {
padding: 15px 30px;
margin: 10px;
font-size: 16px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s;
}
#colorButton {
background-color: #008CBA;
color: white;
}
#navigateButton {
background-color: #f44336;
color: white;
}
// Alert Button Functionality
document.getElementById('alertButton').addEventListener('click', function() {
alert("Hello, welcome to the website!");
});