HTML Elements
An HTML element is the building block of any web page. It's like a mini-container that defines the structure and content of your website. Think of it like a Lego piece; you combine different elements to create the entire website.
Start tag | content | End tag |
---|---|---|
<h1> | This is heading content. | </h1> |
<p> | This is paragraph content. | </p> |
</br> |
So here <p>....</p> is an HTML element, <h1>...</h1> is another HTML element. There are some HTML elements which don't need to be closed, such as </img>, </hr> and </br> elements. These are known as void elements.
Nested HTML Elements
Nested HTML elements refer to the ability of one HTML element to contain other HTML elements within its opening and closing tags. This hierarchical structure is fundamental to building the content and layout of web pages.
Empty HTML Elements
HTML elements with no content are called empty elements.
The <br> tag defines a line break, and is an empty element without a closing tag: