Exercise: HTML Structure and Elements
Objective: Create a basic HTML document, incorporating headers, paragraphs, a title, links, and images.
Instructions:
- Open a Text Editor: Open your preferred text editor (e.g., Visual Studio Code).
- Create the HTML Structure:
- Begin with the HTML document structure as we have discussed.
- Add a Header:
- Inside the
<body>
tag, add an<h1>
header with a title for your webpage.
- Inside the
- Insert Paragraphs:
- Below the header, add two paragraphs (
<p>
) with some content. Make one paragraph about your favorite hobby and the other about your favorite food.
- Below the header, add two paragraphs (
- Include a Link:
- Add an anchor (
<a>
) tag with anhref
attribute linking to a website of your choice. The link text should describe the website.
- Add an anchor (
- Insert an Image:
- Find an image online or use one from your computer. Add an
<img>
tag with thesrc
attribute pointing to the image file. Include analt
attribute with a brief description.
- Find an image online or use one from your computer. Add an
- Add Subheaders:
- Insert two subheaders (
<h2>
or<h3>
) after the paragraphs. These could be related to the content you’ve written.
- Insert two subheaders (
- Conclusion:
- Write a concluding paragraph summarizing the content of your webpage.
- Testing:
- Save your HTML file with an
.html
extension. - Open it in a web browser to view your webpage.