Web Basics

Making a simple web page (HTML file content)

<!DOCTYPE html> <html> <head> <title>My Title</title> </head> <body> <h1>Example Header Text</h1> <!--Example comment--> <p> Example text for a paragraph </p> </body> </html>

Example Header Text

Example text for a paragraph

  • If the markup above is the content of my html file, I can open it in the browser and see a simple page like the result shown.
  • A 'tag' consists of a '<', a label specifying the type, and a '>' (e.g. <h1>).
  • An 'element' usually consists of a start tag, some content, and a matching end tag with a '/' (e.g. <h1>My Header</h1>).
  • The tag type determines how the content is displayed. For example, content between <h1> and </h1> is displayed as a large bold header.
  • An element can contain other (nested) elements.
  • Content between '<!--' and '-->' is a comment, it will not show up on the web page.
  • The <body> element contains page content to be displayed, the <head> element is for metadata and code, etc.
  • The <title> element contains the browser tab label text.

Challenge

Create a simple web page with the title "My Web Page", and write a few paragraphs about yourself. Run the page in the browser.

Completed