-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
50 lines (47 loc) · 1.45 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>My first styled page</title>
<style type="text/css">
body {
padding-left: 11em;
font-family: Georgia, "Times New Roman",
Times, serif;
color: purple;
background-color: #d8da3d }
ul.navbar {
position: absolute;
top: 2em;
left: 1em;
width: 9em }
h1 {
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif }
</style>
<button type="button">Click Me!</button>
</head>
<body>
[etc.]test
-->
<!-- Creating a simple HTML button using the <button> tag -->
<button type="button">Click Me</button>
<!-- Adding some style to the button using CSS -->
<style>
button {
background-color: green; /* setting the background color to green */
color: white; /* setting the text color to white */
border: none; /* removing the border */
padding: 10px 20px; /* adding some space around the text */
cursor: pointer; /* changing the mouse cursor to a pointer when hovering over the button */
}
</style>
<!-- Adding some functionality to the button using JavaScript -->
<script>
// Getting the button element by its tag name
var button = document.getElementsByTagName("button")[0];
// Adding an event listener to the button that executes a function when the button is clicked
button.addEventListener("click", function() {
// Displaying an alert message
alert("You clicked the button!");
});
</script>