Chuyển tới nội dung chính

Submodule 1.3: Simple HTML file

Simple web page

Every HTML page contains some basic elements that are necessary for its structure.

These are:<html>, <head>, <title> and <body>

Almost all HTML elements have a start tag and an end tag. The exceptions will be discussed later in the course.The basic structure of an HTML page is:

The very first statement that exists in any HTML page is the <!DOCTYPE html>.This declaration should only appear one time, at the beginning of our document, and it represents the document type. When we state the document type, we help browsers to display the content of our web page correctly.

Right after the <!DOCTYPE html> comes the <html> tag. Every HTML document begins with <html> and ends with </html>. This tag is the root of our document and is also the place where we state the language of our document. For example, if our content is in English we will have: <html lang="en"> </html>

The <head> elements starts below <html> start tag and close before <body> start tag. It contains information about the web page that usually is not displayed in the page. It also contains the <title> element which is where we state the title of our document. 

The <body> element is where we put our content. Everything placed in the <body> will be visible on our web page.

Exercise

  1. Copy the above code 
  2. Open your editor and create a new file
  3. Paste the code in the page
  4. Save the page as exersice01.3.01.htmland place it in the folder "Exercises".
  5. Preview this page in your browser. 

What do you see?

This is an empty page.

Where does the "Simple Web Page" appear?

In the title of the browser