Well-Formed HTML Document Lab

Objectives

  1. Add an appropriate doctype tag at the top of an HTML file.
  2. Enclose the HTML contents of a site inside html tags.
  3. Structure an HTML document with head and body tags.
  4. Add title tags to give the page a title that will show up in the browser tab.

Instructions

Open index.html in your text editor. Add a doctype tag at the top of the file indicating that the rest of the file will be HTML code. Then create opening and closing html tags to enclose the remainder of your page's content. Add opening and closing head and body tags within the outer html tags to break your HTML document up into two sections. Remember, the head section generally contains data intended for the web browser, and the body section contains the content our users will see and interact with on the page.

You can run the tests with this lab via learn. Make sure you save the file before running the test suite. Failing tests will provide helpful error messages that you can use to debug your code — read them closely for hints!

Viewing your work in the browser

While working through these assignments, your general workflow should center on writing code in the text editor and periodically running the test suite in the terminal to check your work.

Another great way to track your progress is to open up the HTML document in your browser and watch how each change you make in the text editor affects the visual layout in the browser. If you're using a local development environment, you can open the HTML file directly in your browser. If you're coding in the Learn IDE, check out this Help Center article that explains how to spin up and connect to a simple remote server.

Once you have the HTML document open in your browser, you can make changes to it in the text editor, save the file, refresh the page in the browser, and see the changes instantly.

Resources