Lessons menu
HTML - basic - Lesson nr. 2
The structure of an HTML document

An HTML document must contain the following tags:

<!DOCTYPE html> - it defines that the document is HTML5 (currently the newest HTML version). Every HTML file starts with this.

<html></html> - it marks the start and end of the HTML document.
<head></head> - it encloses the header of the document; here we place the title of the document, other references. The descriptions given here do not appear inside the browser window.
<body></body> - it encloses the content that will appear inside the browser window.

 

The tags that are to be placed in the header (between thetags):

<title></title> - the enclosed text appears on the title bar of the browser.
<link> - it refers to an outside file.
<link rel="icon" href="the path to the icon" type="image/ico"> - it can be used to put a small picture before the text of the title on the title bar of the browser

 

Comments in an HTML document:

They are used to leave comments in our code, which are not shown in the browser. Comments may help later if we want to continue the work on our webpage, to know where we left of.

<!-- write your comment here -->

Exercises
1. Between the downloaded files you find one named index.html. Open it in Notepad++ and write in the <title> tag Coders Work.
View the result
2. In the same file, insert the icon named cw.ico to set an icon to the webpage, which appears before the title of the webpage in the title bar of the browser. Use the <link> tag to resolve it.
View the result
3. Insert the following text between the <body></body> tags: Coders Work My name is Mike and I’ll tell you my story about how I draw-up a course to help all those who want to improve their employability by using their passive IT skills.
View the result
4. Write some html comments and check if anything appears on your page after refresh.
View the result
Questionnaire
1. Which of the following statements regarding the structure of a HTML document is true?
2. If we move the picture file named cw.ico to a folder named images next to our index.html file, the correct form of the tag to show the picture in the title bar of the browser is:
3. The text enclosed by the <title> tags in a HTML document:
4. Which of the following statements related to the <link> tag is true?
5. If in an HTML document you see the text below, how will this appear in the browser window?
<!--must continue here -->
Exclamation mark This site is using cookies. By continuing to browse the site, you accept their use! I accept