Mark As Completed Discussion

Setting up an HTML Web page

Now let's start setting up a basic web page. We initialize the HTML document using some specific tags, which consist of <!DOCTYPE html>, <html>, <head> and <body>.

SNIPPET
1<!DOCTYPE html>
2<html>
3<head>
4<title> My First Webpage </title>
5</head>
6<body>
7<h1> Hello World! </h1>
8</body>
9</html>

This creates a document like this.

Setting up an HTML Web page

Let's analyze the purpose of each of these elements.

  1. <!DOCTYPE html> element: This element defines the document type declaration, and informs the browser about which language we are using to create the website. Since we're using HTML, html is specified. Without this specification, the browser will not be able to display the web page.
  2. <html> element: This element defines the entire HTML document, and encloses all other elements.
  3. <head> element: This element defines the metadata about the document. For example, links to style sheets, scripts, or the title of the page (the <title> element as you can see in the above example too) are all defined within this element.
  4. <body> element: All the visible content of the webpage is displayed within this element. Various other elements such as paragraphs, headings, etc are defined within this element.