HTML elements

An HTML element consists of an initial label and a final one, whose objective is to contain some other HTML element inside it or some other content, it is important to clarify that there are also HTML elements without content which are known as empty elements and do not have a label final.

An element is considered all from the initial label to the final label.
Below we show its basic structure.
<tagname> Content goes here... </tagname>

For example:
<p> My paragraph. </p>

The previous example shows an HTML element to create a paragraph, and everything inside it will be part of the paragraph.

A curious fact about HTML elements, is that all HTML douments are full of nested elements, since from the moment that the basic structure of a website is created we are placing elements inside other elements. An example of this, as we said is the basic structure of an HTML document, you can see the code below.
Note: We recommend reading about HTML documents before, here.

Code:
<!DOCTYPE html>
<html>
   <head>
      Design, scripts and much more...
   </head>
   <body>
      <h1>My First Website</h1>
      <p>My first paragraph.</p>
   </body>
</html>

As you can see, all the elements are nested in the HTML name element, <html>. If we search among the nested elements we can see that the <body> element contains more elements which create visual content for the users, in addition if we observe in detail, all the elements of the previous example have a closing tag.

Basically this is all the information you need to know for HTML elements, however we will give you some recommendations below.

Don't forget the end tag.
We mentioned this in the post, but we do not explain it because there are only some elements that can be used in this way, however if you do not finish an tag correctly you can cause problems with the content of your website. Some of the most common elements you can use without having to end with a closing tag are: <br>, <img> and <hr>, although the latter if it has closing tag, you can omit it and most of the browsers will interpret it correctly, however it is not correct to do so.

Empty elements.
The empty elements are important for the creation of written content on a website, because basically one of them is the line break, <br>. These elements, in spite of not having content and not having a closing tag, it is advisable to indicate its closure by adding an inverted diagonal in the following way: <br />.

Use lowercase elements name.
In the case of using pure HTML we should not worry about using the names of the elements in uppercase or lowercase since the browsers interpret the content correctly, however if we use variants of this language for example, XHTML, and use the names in uppercase elements there would be problems with the interpretation of the content.