Course Content
HTML Essentials
HTML Essentials
Tags, Elements, and Attributes
No need to worry! In the following chapters, we will delve into each tag individually and its corresponding attributes. For now, we are simply familiarizing ourselves with the building blocks of HTML.
Tags
- Tags are used to define elements within an HTML document;
- They are enclosed in angle brackets
< >
and come in pairs, consisting of an opening tag (<tag>
) and a closing tag (</tag>
); - The content between the opening and closing tags defines the element;
- Example:
<p>
is the opening tag for a paragraph element, and</p>
is the closing tag.
Elements
- An element is a combination of an opening tag, content, and a closing tag;
- Together, the opening and closing tags define the boundaries of the element;
- Elements can contain text, other elements, or both;
- Example:
<p>This is a paragraph element.</p>
represents a paragraph element with the content "This is a paragraph element.".
Attributes
- Attributes provide additional information about an element;
- They are specified within the opening tag of the element and are written as
name="value"
pairs; - Attributes modify the behavior or appearance of an element;
- Example: In
<img src="image.jpg" alt="Image"/>
,src
andalt
are attributes.src
specifies the source (URL) of the image, andalt
provides alternative text for the image.
Summarizing
Everything was clear?