Student Lab Workbook - Web Technologies: HTML Mastery
Introduction
Welcome to the Student Lab Workbook for Web Technologies! In this workbook, you will find 10 progressively complex exercises designed to teach new learners how to write full-featured HTML pages. By completing these exercises, you will gain a solid understanding of HTML and be able to create your own websites from scratch.
Student Lab Workbook: HTML Basics
Introduction
This workbook contains 10 simple HTML writing exercises that cover various HTML elements. By completing these exercises, you will gain a solid understanding of HTML and become proficient web developers.
Exercise 1: Creating an HTML Document
Create a basic HTML document with a <!DOCTYPE html> declaration, an opening and closing <html> tag, a <head> section containing a <title> tag, and a <body> section.
html
Copy code
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Document</title>
</head>
<body>
</body>
</html>
Exercise 2: Adding Headings and Paragraphs
Add a level 1 heading (<h1>) and two paragraphs (<p>) inside the <body> section of your HTML document.
html
Copy code
<body>
<h1>Welcome to My Website</h1>
<p>My name is John Doe, and this is my personal website.</p>
<p>I love web development and sharing my knowledge with others.</p>
</body>
Exercise 3: Creating Lists
Create an ordered list (<ol>) and an unordered list (<ul>) inside the <body> section, each containing three list items (<li>).
html
Copy code
<body>
...
<h2>My Hobbies</h2>
<ol>
<li>Playing guitar</li>
<li>Reading books</li>
<li>Traveling</li>
</ol>
<h2>My Favorite Websites</h2>
<ul>
<li>example.com</li>
<li>anotherexample.com</li>
<li>yetanotherexample.com</li>
</ul>
</body>
Exercise 4: Adding Images
Add an image (<img>) inside the <body> section, using the src attribute to specify the image file URL.
Add a <style> tag inside the <head> section and provide basic CSS styling for your headings, paragraphs, lists, images, hyperlinks, navigation menu, and footer.
html
Copy code
<head>
...
<style>
body {
font-family: Arial, sans-serif;
}
h1, h2 {
color: #333;
}
a {
text-decoration: none;
color: blue;
}
a:hover {
color: red;
}
nav ul {
list-style-type: none;
padding: 0;
}
nav li {
display: inline;
margin-right: 10px;
}
footer {
text-align: center;
font-size: 0.8em;
}
</style>
</head>
Exercise 9: Creating a Responsive Design
Add a media query inside the <style> tag to make your navigation menu and other page elements responsive.
html
Copy code
<style>
...
@media screen and(max-width:600px) {
nav li {
display: block;
margin-bottom: 10px;
}
img {
max-width: 100%;
height: auto;
}
}
</style>
Exercise 10: Testing and Iterating
Test your HTML document on different devices and browsers to ensure compatibility and consistency. Make any necessary adjustments to your code.
By completing these exercises, you have learned various HTML elements and created a basic, responsive website. Keep practicing anditerating on your code to improve your web development skills. Good luck!
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (