Elements in HTML
We already have seen what is Element in introduction section =. In this section, we will have deeper look.
Element is an entity created by opening and closing tag.
<h1>This is h1</h1> creates h1 element.
Some tags don't have closing tag. like
<img ... /> creates an image tag ( doesn't have closing tag ). These kind of tags are called void tags.
<hr /> are other examples of void elements.
You must have noticed in our previous examples, one element can be nested inside another element. Let us have a look at the example.
This is the parent paragraph.
This is the child paragraph.
<!DOCTYPE html> <html> <head> </head> <body> <p> This is the parent paragraph. <p> This is the child paragraph. </p> </p> </body> </html>
As you can see from the above example, There is a parent paragraph containing child paragraph. You can add other elements also.
If you take more wide view,
html is a parent element.
body are nested inside
In this section, you learned about Elements and nested elements.
In next section, you will learn about attributes of elements in HTML.