HTML - Structural Tags

Chapter 10 · Tamil Nadu State Board

  • 9 min read
  • 5-question quiz

Every key point below shows the sentence from your textbook it comes from. Book back answers are solved and checked against the book; answers we could not prove are left out. How we check content

In short

This lesson teaches how HTML tags organise a web page into a document, heading and body. It explains how the structural tags identify the page, its browser title and the content shown in the browser window. It also shows how to write, save, view and edit an HTML file using a text editor and browser. Understanding the structure helps students create and check basic web pages.

Written by AI from this lesson. How we check it

Key points

  • HTML uses tags to describe a document’s structure and how its contents are displayed.
    From your textbook
    “It describes the structure of a document.”
  • The four structural tags are <html>, <head>, <title> and <body>.
    From your textbook
    “<html>, <head>, <title> and <body> these four tags are known as structural tags.”
  • The <html> tags mark the beginning and end of an HTML document.
    From your textbook
    “Entire HTML document is bounded within a pair of <html> and </html> tags.”
  • The head section holds document information, while the body section holds the content displayed in the browser.
    From your textbook
    “The body section is used to display the main content on the browser window.”
  • A page title is placed inside <title> tags within the head section and appears in the browser title bar or page tab.
    From your textbook
    “The title specified between opening and closing tags appears in the title bar / page tab of the browser.”
  • An HTML page can be written in a text editor and viewed in a browser without a network.
    From your textbook
    “You can write, test and link web pages without a network.”
Test yourself: 5 questions

Formulas in this chapter

What HTML Does

Definition

HTML
HTML (Hyper Text Markup Language) is a markup language that describes a web document’s structure and tells a browser how to display its contents.

HTML can display text, images, animations and other content. It can also make a document interactive through hyperlinks. HTML is not a word processing tool or a programming language.

HTML uses tags and attributes. Tags are HTML elements, while attributes provide extra information such as colour or alignment. Tags are written inside angle brackets (< >), and HTML is not case sensitive.

Remember: Browsers treat <HTML> and <html> in the same way.

HTML Document Structure and Structural Tags

An HTML document has a heading section and a body section. The heading section gives information about the document, including its title. The body section contains the main content shown in the browser window.

The four structural tags

Tag pairPurpose
<html> and </html>Identify the document as an HTML document and enclose the whole document.
<head> and </head>Contain information about the document, including its title, scripts, style definition and descriptions.
<title> and </title>Contain the document title, which appears in the browser title bar or page tab. Place these tags inside <head>.
<body> and </body>Enclose the content displayed on the web page. Place <body> below </head>.

Most tags have an opening tag and a closing tag around the content they affect. The closing tag uses the same name with a slash before it, as in <html> and </html>.

Remember: The four basic structural tags are <html>, <head>, <title> and <body>.

Tools for Writing and Viewing HTML

What you need

  • A text editor to write HTML code, such as Notepad for Windows or getit for Linux.
  • A browser to view the web page.
  • A web server, web hosting and internet connection are not needed to write, test or link web pages.

Create and save a web page

  • Open a text editor. In Windows7, use Start → All Programs →Accessories → Notepad.
  • Type the HTML document in the editor.
  • Choose File → Save or press Ctrl + S.
  • Enter a file name with the .htm or .html extension.
  • Choose “All Files” from “Save as type” and click “Save”.

View a web page in a browser

  • Open a browser.
  • Choose File → Open File or press Ctrl + O.
  • Find the folder where the HTML document is saved, select the file and click “Open”.

The source file is the HTML document typed in the text editor. In a browser, right-click and choose View Page Source (Firefox and Chrome) or View Source (Internet Explorer). You can also press Ctrl + U in any browser; in Internet Explorer, use View → Source.

Remember: You can view a source file in the browser, but you cannot edit it there using these methods.

Edit and Reload an HTML File

Edit an HTML source file in a text editor. You do not need to close the browser while editing. After saving your changes, refresh or reload the page in the browser to see them.

Edit and save the source file

  • Open the folder containing the source file.
  • Right-click the file and choose Open With → Notepad.
  • Make your changes and save with File → Save or Ctrl + S.

Reload the changes

  • Minimize the text editor and go to the browser.
  • Click the browser’s Refresh or Reload icon.
  • You can also press Ctrl + R or F5.

HTML Attributes and the <html> Tag

Definition

Attribute
An attribute is a special word inside an opening tag that gives extra information about that tag.

Global attributes can be used with any HTML element. The <html> tag marks the beginning and end of an HTML document. It does not change the document’s appearance.

Attributes of the <html> tag

AttributePurpose and values
dirSets text direction. ltr is the default value; rtl is used for Arabian languages.
langSets the document language using a predefined code, such as English – en, Tamil – ta, Telugu – te, Malayalam – ml, Kannada – kn, Hindi – hi, French – fr, and Ge

Body Tag: Colours and Background Images

The <body> tag contains the contents of an HTML page. Its bgcolor attribute sets the background colour, and its text attribute sets the body text colour. The default body text colour is black.

Set background colour

<body bgcolor = color_name/color_code>

color_name or color_code gives the background colour.

Set body text colour

<body text = color_name/color_code>

color_name or color_code gives the body text colour.

A colour code uses six hexadecimal digits: the first two represent Red, the next two Green, and the last two Blue. Each pair ranges from 00 – FF. Put # before a colour code.

Examples of hexadecimal colour codes

ColourCode
Red#FF0000
Blue#0000FF
Green#008000
Yellow#FFFF00
Black#000000
White#FFFFFF
Set a background image

<body background = “image_name_with_extenstion”>

image_name_with_extenstion identifies the image used as the page background.

The page text appears on top of the background image. A small image repeats across and down to fill the browser window. If the image is in another folder or drive, include its file path. Use double quotes when the file name is long, has spaces, or includes a path.

Body Tag: Margins and a Complete Example

Definition

Margin
A margin is blank space between the browser window’s edge and the body content.
Set left and top margins

<body leftmargin = value topmargin = value>

leftmargin sets space from the left edge, and topmargin sets space from the top edge; value is in pixels.

The example uses 50 pixels for both margins. The text is placed 50 pixels from the left and top edges of the browser.

Worked example

Create a page titled My First Web Page. Display Welcome to Computer Applications with a Lime background, blue text, and left and top margins of 1 inch.

Try it first, then show the solution
  1. Put the page title inside the <title> tag.
  2. Set bgcolor to Lime and text to blue in the <body> tag.
  3. Use 72 for both margins.

Answer: <html> <head> <title> My First Web Page </title> </head> <body bgcolor = Lime text = blue leftmargin = 72 topmargin = 72> Welcome to Computer Applications </body> </html>

Remember: When a tag has more than one attribute, separate the attributes with spaces.

HTML Heading Tags

Headings give titles to sections of a web page. HTML has six levels, from <h1> to <h6>. The number shows the heading level, and the text appears larger and bolder according to that level.

Heading tag pattern

<h#> Heading text </h#>

# is the heading level, from 1 to 6.

Definition

Align attribute
The align attribute sets a heading's alignment to Right, Center or Justify.

Left is the default heading alignment. Justify alignment is meant for paragraphs and is not supported by older browsers. The Left align setting is not supported in the latest version of HTML.

Worked example

How can you center a first-level heading?

Try it first, then show the solution
  1. Write the heading text between <h1> and </h1>.
  2. Add align=center inside the opening tag.

Answer: <h1 align=center> Welcome to Computer Application </h1>

Line Breaks and Paragraphs

A browser does not treat returns, tabs or repeated spaces as line breaks. Several lines in the HTML code may appear as one line in the browser. Use the <br> tag to start a new line.

Definition

<br> tag
The <br> tag inserts a line break and is an empty tag with no closing tag or attribute.

Definition

<p> tag
The <p> and </p> tags mark text as a paragraph, which the browser displays separately.

Pressing Enter in the HTML code does not create a paragraph in the browser. Put each paragraph's text between <p> and </p>. Paragraphs are left-aligned by default.

Paragraph alignment pattern

<p align = alignment>

alignment can be Right, Center or Justify; Left is the default.

Paragraph alignment choices

  • Left: the default alignment.
  • Right: aligns the paragraph to the right.
  • Center: centers the paragraph.
  • Justify: sets justified alignment.

Remember: Word processor keyboard shortcuts for paragraph alignment do not work in HTML.

HTML Comments

Definition

Comment
A comment is text in an HTML document that the browser ignores and does not show onscreen.

Comments can describe a page or indicate its status. They can be placed anywhere in the HTML document.

Comment form

<! comments >

The text inside the comment form is treated as a comment.

Container and Empty Elements

Two types of HTML elements

Container elementsEmpty elements
Need an opening tag and a closing tag.Need only an opening tag.
Examples: <html>, <body>, <title> and <p>.Example: <br>.

HTML tags are also called elements. Structural tags include <html>, <head>, <title> and <body>. The <body> section contains the main content of a web document.

Remember: A container element has opening and closing tags; an empty element has only an opening tag.

Questions students ask

Short, direct answers to what students search for in this chapter.

What is HTML?

HTML (Hyper Text Markup Language) is a markup language used to create web pages. It describes a document’s structure and tells browsers how to display text, images, animations and other content. It can also make documents interactive through hyperlinks.

What are the four structural tags in HTML?

The four structural tags are <html>, <head>, <title> and <body>. The <html> tags enclose the document, <head> contains document information, <title> sets the browser title, and <body> encloses the content shown on the web page.

What is the difference between the head section and the body section in HTML?

The head section is enclosed by <head> and </head> and contains information about the document, including its title. The body section is enclosed by <body> and </body> and contains the main content displayed in the browser window.

How do I save an HTML file?

In the text editor, choose File → Save or press Ctrl + S. Enter a file name ending in .htm or .html, select “All Files” from “Save as type”, and click “Save”.

How do I view the HTML source in a browser?

Right-click the browser and choose View Page Source in Firefox and Chrome, or View Source in Internet Explorer. You can also press Ctrl + U in any browser. These methods display the source file, but do not let you edit it.

How do I edit and reload an HTML source file?

Open the source file in a text editor, such as Notepad, make your changes, and save them with File → Save or Ctrl + S. Then go to the browser and refresh or reload the page. Ctrl + R or F5 can also reload it.

Show 14 more questions

What are HTML attributes?

HTML attributes are special words placed inside an opening tag. They give additional information about the tag. Some attributes are global and can be used with any HTML element.

What do dir and lang mean in the <html> tag?

The dir attribute sets the text direction: ltr is the default, and rtl is used for Arabian languages. The lang attribute identifies the document language with a predefined code, such as en for English or ta for Tamil.

How do I change the background and text colours in HTML?

Use the bgcolor attribute in the <body> tag to set the background colour, and use the text attribute to set the body text colour. Each can take a colour name or a hexadecimal code. Put # before a hexadecimal code.

How do I set a background image and margins in HTML?

Use background in the <body> tag to specify the image file. Include its path if it is in another folder or drive. Use leftmargin and topmargin to set the blank space from the left and top edges; their values are in pixels.

How many heading levels are there in HTML?

HTML has six heading levels, written from <h1> to <h6>. The number shows the level. Heading text appears larger and bolder according to its level.

Why does HTML need a br tag for a line break?

A browser does not recognize returns, tabs or repeated spaces as line breaks. Use the empty <br> tag at the end of a line to make the browser start a new line.

How do you create a paragraph in HTML?

Place the paragraph text between <p> and </p>. The browser identifies that text as a paragraph and displays it separately. Paragraphs are left-aligned by default.

What is the difference between container and empty elements in HTML?

Container elements need both an opening tag and a closing tag, such as <p> and </p>. Empty elements need only an opening tag. The <br> tag is an example of an empty element.

Do HTML comments appear on the webpage?

No. The browser ignores comment text, so it does not appear onscreen. Comments can describe the page or indicate its status, and they can be placed anywhere in the HTML document.

What is HTML used for?

HTML means Hyper Text Markup Language. It is used to create web pages.

What is an HTML tag?

An HTML tag is a coded HTML command. It is also called an element.

What is an attribute in HTML?

An attribute is a special word with a special meaning that is used inside an HTML tag.

What is the difference between the heading section and body section of a browser?

The heading section refers to the browser’s title bar. The body section refers to the browser’s main client area.

What is a text editor?

A text editor is an application used to type and modify text. It is not a word processor. Notepad is a default text editor available with Windows, and Getit is a default text editor available with Linux.

Book back answers

24 textbook exercises, solved and checked against the book. Questions we could not prove are left out.

Choose the correct answer

  1. HTML is acronym for

    • (a) Hyper Transfer Markup Language
    • (b) Hyper Text Markup Language
    • (c) Hyper Transfer Makeup Language
    • (d) Hyper Text Makeup Language
    Try it, then show the answer

    (b) Hyper Text Markup Language

    HTML stands for Hyper Text Markup Language.

    From the book: “HTML (Hyper Text Markup Language) is a special markup language used to create web pages”

  2. The coded HTML keywords that indicates how web browser should format and display the content is called…….

    • (a) Tags
    • (b) Attributes
    • (c) Headings
    • (d) Body
    Try it, then show the answer

    (a) Tags

    The chapter identifies HTML commands or keywords as tags that indicate how the browser should format and display content.

    From the book: “The tags are coded by HTML commands or keywords that indicate how web browser should format and display the content.”

  3. Which of the following is a special word used inside tag to specify additional information to the tag?

    • (a) Tags
    • (b) Attributes
    • (c) Headings
    • (d) Body
    Try it, then show the answer

    (b) Attributes

    Attributes are special words placed inside a tag to give it additional information.

    From the book: “Attributes are special words used inside a tag to specify additional information to a tag.”

  4. HTML tags should be specified within:

    • (a) [ ]
    • (b) { }
    • (c) ( )
    • (d) < >
    Try it, then show the answer

    (d) < >

    HTML tags are written within angle brackets.

    From the book: “All HTML tags should be specified within angle brackets (< >).”

All 24 book back answers →

Practice

Question 1 of 5Score 0

Which set contains all four structural tags?

Exam questions

Practice questions with model answers. These are not from an official paper.

Name the four structural tags and state what they are used for.5 marks

Structural tags are the basic essential elements used to construct a web page. They define the structure and main sections of an HTML document.

  1. <html> tag: Identifies the document as an HTML document and encloses the entire document.
  2. <head> tag: Contains information about the document, such as its title, scripts, style definitions and descriptions.
  3. <title> tag: Specifies the document title, which appears in the browser’s title bar or page tab. It is placed within the <head> tag.
  4. <body> tag: Encloses the tags, attributes and information that are displayed on the web page. It is entered below the </head> tag.

Together, these four tags form the basic structure of an HTML web page.

Explain the difference between the head section and the body section.2 marks

The head section contains information about the document, including its title. The body section contains the main content that is displayed in the browser window.

How do you save an HTML document using a text editor?5 marks

An HTML document can be created in a text editor and saved as an HTML file. Follow these steps to save it.

  1. Open a text editor: Open Notepad in Windows using Start → All Programs → Accessories → Notepad.
  2. Type the document: Type the HTML document in the text editor.
  3. Open Save: Choose File → Save, or press Ctrl + S.
  4. Enter the file name: In the File Name text box, type a name with the .htm or .html extension.
  5. Choose the file type: Select “All Files” from the “Save as type” list box.
  6. Save the file: Click the “Save” button to save the HTML document.

Example: Save the file using a file name with the .htm or .html extension.

The document is saved as an HTML file.

How can you view an HTML page in a browser?5 marks

An HTML page can be viewed in a browser after creating and saving it as an HTML file. The browser displays the page when the saved file is opened.

  1. Open a browser: Start a browser such as Internet Explorer or Mozilla Firefox.
  2. Open the file command: Choose File → Open File, or use the keyboard shortcut Ctrl + O.
  3. Browse to the saved folder: In the Open dialog box, go to the folder where the HTML document was saved.
  4. Select and open the file: Choose the HTML file and click the Open button.
  5. View the webpage: The web page is then displayed in the browser.

Example: Open a saved HTML document in Internet Explorer or Mozilla Firefox using File → Open File, then browse to the folder, select the file and click Open.

Thus, a saved HTML file can be viewed by opening it from a browser.

Watch out

  • Do not confuse the head section, which holds document information, with the body section, which displays the main content.
  • Do not treat a tag and an attribute as the same thing: a tag marks an HTML element, while an attribute supplies additional information inside a tag.

Still stuck on this lesson?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →