<!DOCTYPE html> <html> <head> <title>My Simple Webpage</title> </head> <body> <h1>Welcome to My Simple Webpage!</h1> <p>This is the first paragraph of my webpage.</p> <p>And this is the second one.</p> </body> </html>
Exercise 2:
Add a link to another webpage in your HTML document.
Solution:<!DOCTYPE html> <html> <head> <title>My Simple Webpage</title> </head> <body> <h1>Welcome to My Simple Webpage!</h1> <p>This is the first paragraph of my webpage.</p> <p>And this is the second one.</p> <a href="https://www.example.com">Click here to visit another webpage</a> </body> </html>
Exercise 3:
Add an image to your webpage.
Solution:<!DOCTYPE html> <html> <head> <title>My Simple Webpage</title> </head> <body> <h1>Welcome to My Simple Webpage!</h1> <p>This is the first paragraph of my webpage.</p> <p>And this is the second one.</p> <a href="https://www.example.com">Click here to visit another webpage</a> <img src="image.jpg" alt="Description of image"> </body> </html>
Please replace “image.jpg” with the path to your image file.
Exercise 4:
Use CSS to change the color of your header and the background color of your page.
Solution:<!DOCTYPE html> <html> <head> <title>My Simple Webpage</title> <style> body { background-color: lightblue; } h1 { color: green; } </style> </head> <body> <h1>Welcome to My Simple Webpage!</h1> <p>This is the first paragraph of my webpage.</p> <p>And this is the second one.</p> <a href="https://www.example.com">Click here to visit another webpage</a> <img src="image.jpg" alt="Description of image"> </body> </html>
Exercise 5:
Use JavaScript to create an alert that pops up when a button on your page is clicked.
Solution:<!DOCTYPE html> <html> <head> <title>My Simple Webpage</title> <style> body { background-color: lightblue; } h1 { color: green; } </style> <script> function showAlert() { alert("Button was clicked!"); } </script> </head> <body> <h1>Welcome to My Simple Webpage!</h1> <p>This is the first paragraph of my webpage.</p> <p>And this is the second one.</p> <a href="https://www.example.com">Click here to visit another webpage</a> <img src="image.jpg" alt="Description of image"> <button onclick="showAlert()">Click me</button> </body> </html>
In the above code, when the button with the text “Click me” is clicked, the JavaScript function showAlert is called, which creates an ale