Home » HTML

Introduction to Elements in HTML

HTML Elements: In this tutorial, we are going to learn about the introduction to elements in HTML code.
Submitted by Jhanvi Tripathi, on July 22, 2019

An element is a fundamental component that is used to develop web pages. Generally an element as two components: a starting tag and a closing tag. The content is added in between the starting and closing tags. The ending tag is the same as the starting the staring tag except that the ending tag precedes with a "/".

Syntax:

    <h1 align="right"> A HEADING </h1>

Here,

  • H1: tag name, starting tag
  • align="right": name and value. It is an attribute
  • A HEADING: Content
  • /H1: end tag

Types of the HTML elements

The elements in the HTML are classified in two types,

1) Container Elements

These elements have a starting and an ending tag. The content is given in between the tags.

Example:

    <b>this element is used for bold text</b>

2) Empty Elements

These elements do not contain an ending tag. They have a starting tag only. These elements are used for performing some specific functions.

Exampple:

    This element is used to give a horizontal rule or say line.
    <hr />

The HTML elements can also be used in a nested form.

    <b> <i> to give BOLD and ITALICS letters </i> </b>

With the nested elements one should careful with the closing tags. That means the inner tags should be closed first then the outer tags. Like in the above example, the <i> tag closed before the <b> tag.

TEXT-LEVEL ELEMENTS

It is also known as inline elements, they affect the appearance of the text in a web-page.

It is of two types,

1) Physical Elements

It is also known as the character formatting elements, it specifies the display of the text on the webpage. For example: to highlight or to underline the text in the webpage. Some commonly used elements are BOLD (<b>...</b>), ITALICS (<i>...</i>), UNDERLINE (<u>...</u>), SUPERSCRIPT (<sup>...</sup>), SUBSCRIPT (<sub>...</sub>), and STRIKE (<strike>...</strike>).

2) Logical Elements

It describes the logical or general description of the webpage. These elements are used to define the structural importance of the text. Some commonly used logical elements are SAMPLE, CODE, CITE, STRONG, EMPHASIS, VARIABLE.

BLOCK-LEVEL ELEMENTS

The block elements are used for defining a block of text in the HTML document. These elements could be nested and used. It gives a structure of a block containing other block elements. Some common examples are HEADING, PARAGRAPH, BREAK, HR AND CENTER.

Some Elements of HTML

<HTML>

This element defines the ones complete HTML document. Also, it is used as the first tag of the HTML document. It is a container element as it has both the starting and closing tag.

    <HTML> ... </HTML>

<BODY>

This element defines the body of the document. The element or the content that has to be added to the webpage is given in the HTML body. It has both the starting and the ending tag.

    <BODY> ... </BODY>

<HEAD>

The element is used for the head of the document. This element contains the title of the document, linking to scripts, adding style by style tag, etc.

    <HEAD>
        <TITLE> MY TITLE </TITLE>
        <STYLE> . . . </STYLE>
    </HEAD>






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.