×

HTML Elements

An HTML element is nothing but a starting tag and then some content and then the closing tag. So we can say HTML elements is everything from the starting tag to the ending tag.

For example:

<tagname>some content</tagname>

Now taking a real time example:

<h1>This is my first heading</h1>

Note: In HTML, we have some special elements which has no content. For example the <br> element. So these elements are called empty elements. In simpler words, we can say that empty elements do not have an end tag.

Nested HTML elements:

In HTML, the elements can be nested which means HTML elements can contain other elements. All the HTML documents consist of nested HTML elements. The following example has four HTML elements:

  1. <html>
  2. <body>
  3. <h1>
  4. <p>

Example:

<html>
<body>
<h1>Apple</h1>
<p>An apple is an edible fruit produced by an apple tree (Malus domestica). Apple trees are cultivated worldwide and are the most widely grown species in the genus Malus. The tree originated in Central Asia, where its wild ancestor, Malus sieversii, is still found today</p>
</body>
</html>

Output:

HTML Elements

Therefore, in this basic example, we can clearly see that how HTML elements contain other elements. So, in that example as we can see that we have <html> element, it is known as the root element and it is used to define the whole html element. It has a starting tag and ending tag as well but as we can see between those tags we have many elements like <body> tag which is used to define the documents body. It has a starting tag and closing tag as well. And as we can see inside body element, we have two other elements namely <h1> tag and <p> tag. <h1> element defines a heading it also has opening and closing tag as well. And that <p> element defines a paragraph. It also comes with a starting and closing tag.

Never skip the End Tag:

There are some elements in html which will display correctly even after you have forgot to input the ending tag. For example: <p> tag. But we should not rely on this because at the time of execution, it may come up with unexpected errors, if you forget the ending tag. The following example shows that how a paragraph tag works without its ending tag.

For example:

<html>
<body>
<p>This is an paragraph without its ending tag
<p>This is also an paragraph without its ending tag
</body>
</html>

Output:

HTML Elements

Empty HTML Tag:

HTML elements with no content are called empty elements. For example: <br> tag is used to define a line break in html, and it is an empty element because it does not have a closing tag. And when a tag does not have end tag so there is no point in giving that element a content. So that’s how empty html elements work.

For example:

<html>
<body>
<p>This is a <br> paragraph with a line break.</p>
</body>
</html>

Output:

HTML Elements

HTML is not case sensitive:

HTML is not a case sensitive language means <p> is same as <P>. In html, standard does not require lowercase tags.

HTML Tags:

There are several html tags like <html>, <body>, <h1>……to <h6>. And we have different descriptions to each of these tags.


Related Topics

HTML Button Disabled

The HTML <button> element has many attributes, one of them is the disabled attribute. The button on which you apply the disabled attribute will not work, or we can say...

4 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

HTML Form Input Types

HTML Form Input Types An important element of the HTML form is < input type= "> in HTML. The type attribute of the input element can be of different types, which...

8 minutes read.

HTML Forms

Forms are required when we want to collect data from the user. Html forms consists of different fields to take user inputs such as: input, text area, checkbox, password, radio...

4 minutes read.

HTML Background Image

Inserting image in HTML An image (technically digital image) in HTML or even in general technical aspects, is a binary representation of visual information. By visual information we mean, in the...

8 minutes read.

Html &lt;center> Tag

The term HTML refers to Hyper Text Markup Language. The most widely used markup language for making web pages is HTML. A structure of web page is described in HTML....

3 minutes read.

HTML Layouts

HTML Layouts HTML templates provide a way for well-managed, well-structured responsive web pages to be organized. We could say that the HTML layout specifies how web pages can be set up....

4 minutes read.

HTML <br> tag

HTML is referred to as Hyper Text Markup Language, which is the most popular language for creating Web pages. HTML explains the construction of a Web page. It contains a...

4 minutes read.

HTML Audio

HTML AUDIO: HTML5 provides a method to embed the audio file into a webpage by using HTML5. Before HTML5 audio files is used to play on the browser with the help of...

1 minute read.

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 minutes read.

HTML SVG

HTML SVG: SVG stands for Scalable Vector Graphics which defines the graphics for the web. It is a language for describing 2-D graphics in XML. Each drawn shape in SVG is...

1 minute read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

Difference between HTML and DHTML

Introduction to HTML HTML stands for Hypertext Markup Language. It is a standard web language used to create web pages and applications. HTML is used to define the structure and content...

4 minutes read.

Most Commonly used Tags in HTML

In this tutorial, we'll look at the most popular HTML tags. We know HTML is a fundamental requirement for creating a website. As a result, it is essential to remember...

9 minutes read.

How to insert spaces/tabs in text using HTML/CSS

What is HTML? HTML or HyperText Markup Language is used to design web pages. It was released in 1993. The file extension name for HTML file is “.html”. An HTML file...

4 minutes read.

Html &lt;Col> Tag

You can write the col tag inside the table tag after the thead, tbody, foot, and tr tags. You can also apply it after the caption tag (in which the...

4 minutes read.

Html &lt;datalist >Tag

The autocomplete feature in HTML files is provided by the <datalist> tag. It can be used in conjunction with an input tag to enable users to quickly fill out form...

4 minutes read.

HTML Paragraphs

In html, there are some elements which starts with new line and one of them is paragraph. Which is said to be a block of text. In html <p> tag...

4 minutes read.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 minutes read.