HTML Elements
In the first lesson we have studied about tags and things like start tag (opening tag) and end tag (closing tag).
An HTML element is usually composed of a "Start Tag","Element Content" and an "End tag".
Example:
<p> This is an element content </p>
Output:
This is an element content
The example HTML Element above is composed of the following:
1.start tag: <p>
2.element content: This is an element contetnt.
3.end tag: </p>
Example:
<p> Learning HTML Elements </p>
Output:
Learning HTML Elements
The example HTML Element above is composed of the following:
1.start tag: <p>
2.element content: Learning HTML Elements
3.end tag: </p>
Nested HTML Elements
There are some cases thet an HTML element can contain one or more HTML elements.
For you to better understand it look at the example code below:
Example:
<p><i> Italicized text </i></p>
Output:
Italicized text
The example nested HTML elements above are composed of the following:
1.Start tag: <p>
2.Start tag: <i>
3.Element content: Italicized text
4.End tag: </i>
5.End tag: </p>
Our the example above, there are two start tags and two end tags
The second tag i.e <i> italicized the txt within
Empty Elements
Empty Elements are elements that do not have an element content and an end tag
A list of commonly used Empty Elements:
1.<meta />
2.<link />
3.<img />
4.<br />
5.<hr />
6.<input />
The best practice in HTML Empty Elements is to always put a forward slash / sing before the greater the > sign.
In this way they are closed at their start tags.
Post a Comment