Introduction
HTML elements are the building blocks of an HTML document. An HTML element is defined by a start tag, some content, and an end tag. For example, the following code creates an HTML paragraph element.
Refer to the following code snippet.
1<p>This is a basic HTML5 page.</p>
Let's explore the code.
- The opening tag<p>: This indicates where the element starts. This consists of the name of the element, wrapped in opening and closing angle brackets.
- The content: This indicates the text in this case, "This is a basic HTML5 page."
- The closing tag</p>: This looks exactly like the opening tag except for the extra slash before the name of the element. This tag goes at the end of the element.
The opening tag, the content, and the closing tag together make up the element.

Note
You can find a list of all HTML elements on the website of the World Wide Web Consortium (W3C), the organization that develops and maintains the HTML standard. There you can also find a documentation about each element.
Nesting Elements
HTML elements can be nested inside each other to create more complex structures. Let's take a look at the example.
1<p> We <b> deliver </b> local Food in a radius of <b> 5km </b> ! </p>
The <b> HTML element is used to draw the reader's attention to the element's contents, which are not otherwise granted special importance.
This is the output of the code.

It's important to note that when using nesting elements, the inner elements must be closed before the outer elements. In the example above, the "b" elements are closed before the "p" element.
Block and Inline Elements
In HTML5, elements can be categorized as either block-level, inline, or inline-block elements.
Block-level Elements
Block-level elements in HTML5 are elements that create a block of content on a web page. They are often used to structure and organize content into sections and paragraphs, and they typically take up the full width of their parent container and stack vertically on top of each other.
When using block-level elements, it's important to remember that they will create a new line before and after the element by default. This means that any content that comes after a block-level element will appear on a new line, even if it's on the same line in the HTML code.
1234<ul>
<li>These are block level Elements</li>
<li>We use an li Element in a ul Element to create a list</li>
</ul>
This is the output of the code.

Inline Elements
Inline elements in HTML5 are elements that are meant to be used within a line of text. They typically do not create a new line or block of content on the web page, but rather appear within a sentence or paragraph of text.
1<p> Today is <em>Burger</em> <b>Day.</b>
This is the output of the code.

Empty Elements
Not all elements follow the pattern with an opening tag, the content, and a closing tag. Some elements only need a single tag, which is often used to embed something on a page. The <img> element, as an example, is one of these empty elements, which is used to embed an image file. It is self-closing and does not have a closing tag.
Here is an example from an empty tag to embed an Image:
1<img src="Beach.jpg" alt="Sample Text ">
An empty element is an element that cannot have any child nodes.
Attributes
Attributes are used to provide additional information about an HTML element and modify its behavior or appearance. They are added to the opening tag of an element.
Attributes should possess the following:
- A space between the element name and the attribute name - for an element with more than one attribute, the attributes should also be separated by spaces
- The attribute name, followed by an equal sign
- An attribute value, wrapped with opening and closing quote marks
In this example, we use the <a> element to embed a link. The href attribute from the <a> element is used to specify the URL of a hyperlink that links to another web page or resource.
1<a href="https://www.learning.sap.com">Free SAP Training</a>
This is the output of the code.

When the user clicks on the link, the URL that is in the href attribute opens.
When we deal with CSS later, we can use selectors to determine to which elements the respective CSS rule should apply. This can be done, for example, with the help of the attribute ID. The HTML id attribute is used to specify a unique id for an HTML element.
Note
You can find a list of all HTML attributes on the W3C website, the organization that develops and maintains the HTML standard.