×

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 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 Links

It consist of anchor element which is used to create a link between a source anchor and destination anchor. The anchor tag can be embedded between text, image, video or...

2 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 Wbr Tag

The Line Break Opportunity element A word break opportunity is a place in text from where the browser breaks a line. This opportunity is represented by the element wbr in the...

2 minutes read.

HTML <source> tag

For media attributes, such as <video> tag, <audio> tag, and <picture> tag, we use the <source> tag in html for adding such type of multiple media html elements in our...

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.

How to insert 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 form of drawings/pictures,...

5 minutes read.

HTML Form Action

The <form> tag has an attribute named action that contains a URL. The HTML action attribute defines the webpage URL on which you want to send the data after submitting...

4 minutes read.

HTML City tag

HTML <City> tag HTML < cite > tag specifies a citation, a reference or title to a creative work, quoted content, books, websites, a research paper, a blog post, a painting,...

3 minutes read.

HTML Basic Tags

Heading Tags: This tag represents the document header. It is said to be a good practice if every document starts with Heading. Heading tags ranges from H1 to H6 i.e....

3 minutes read.

HTML Lists

HTML List HTML lists are used to specify data sets. All lists can include one or more elements from the list. HTML lists are available in three different types: Ordered List or...

4 minutes read.

Html <colgroup> Tag

A HTML table's column group is specified by the "colgroup" tag. If you want to apply various properties to one or more <col> elements in an HTML table, then you...

4 minutes read.

CSS Clearfix

CSS Clearfix: A clearfix (or clear float) in CSS is for a component to clear or fix the child component, so we don’t need to insert additional markup. The clear...

4 minutes read.

HTML Ordered List

We use <ol> tag to make an ordered list in html. An ordered list is made to make a list of items in ordered form, ordered list can be either...

3 minutes read.

HTML <select> tag

This tag helps in making the drop-down list on the web page. This is highly used in HTML forms for taking the input from user. You can use the id attribute...

3 minutes read.

HTML <video> Tag

The Video tag in HTML is used to play video on a media player on the web page. We can also insert an audio by the video tag, but audio...

6 minutes 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 <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.

HTML Headings

The titles and subtitles of our webpages are known as HTML headings. Let’s not talk about webpages but giving heading to almost everything like normal paragraphs, articles or let it...

2 minutes read.

HTML &lt;body> alink Attribute

HTML <body> alink Attribute What is HTML? The HTML or HyperText Markup Language is used to design web pages. The file extension name for HTML file is ".html". It was released in...

2 minutes read.