HTML Elements
Lots of beginners find it hard to fint difference between HTML elements, nested elements, and tags. Let's break it down step-by-step to clarify these generalities.
What's an HTML Element?
An HTML element is a complete unit that includes:
Start tag + Content + End tag
Example
<p> Welcome to MK_Coder.com </p>
-
<p>→ Opening tags (start of the element) -
Welcome to MK_Coder.com→ Content inside the element -
</p>→ ending tags (End of the element)
Nested Element
Sometimes, elements are placed inside other elements. This is called nesting. Imagine a box inside a bigger box.
Example of a Nested Element
<div>
<h1>Learn from MK_Coder.com</h1>
<p>This is a paragraph inside a div.</p>
</div>
-
<div>. . .<div>is the parent element. -
<h1>. . .</h1>and<p>. . .</p>are child elements inside the div.
HTML elements help structure the webpage just like build blocks!