<div>
<h1>Main Heading</h1>
<p>This is a paragraph.</p>
<ul>
<li>List item 1</li>
<li>List item 2</li>
</ul>
</div>
2.3.1. Understanding Block-Level Elements
2.3.2. Understanding Inline-Level Elements
2.3.3. Understanding Inline-Block Elements
4.3.1. Text Formatting Elements
4.3.2. Hyperlink and Multimedia Elements
4.3.3. Interactive Elements: Forms and Inputs
4.3.4. Data Representation Elements: Tables and Lists
HTML elements are the complete components that consist of an opening tag, content, and a closing tag (except for void elements). HTML tags, on the other hand, are the opening and closing parts of an element that surround the content. In other words, tags are used to define the structure and meaning of the content within an element.
The three main HTML elements that form the basic structure of an HTML document are:
Block-level elements start on a new line and occupy the full width available within their parent container. They create a new block of content and can contain other block-level or inline elements. Examples of block-level elements include <div>, <p>, <h1> to <h6> and <ul>.
Inline elements do not start on a new line and only take up as much width as necessary to display their content. They are typically used within block-level elements to apply formatting or interactivity to specific parts of the content. Examples of inline elements include <span>, <a>, <img>, and <strong>.
Empty HTML elements, also known as void elements, are elements that do not have a closing tag and cannot contain any content. They are self-closing and are typically used to insert specific functionality or content into a web page. Some common empty elements include:
Empty elements are used to add specific functionality or content without the need for a closing tag or inner content.
HTML attributes provide additional information or functionality to HTML elements. They are specified within the opening tag of an element and consist of a name-value pair. Attributes can modify the behavior, appearance, or functionality of an element. Some common attributes include:
Attributes play a crucial role in extending the functionality and providing additional information to HTML elements, allowing for more dynamic and interactive web pages.