Nested HTML Elements

Introduction

All the examples we have discussed in our previous article had one tag. Now, let’s assume, you have a requirement to show some texts of a sentence in bold and others as simple text. This can be achieved using nested html elements. This can be easily understood by given example:

Example:

In this code, we have used two tags <p> and <b>.

Nested HTML Elements

Note: HTML tags are not case sensitive. Thus, <b> and <B> will behave in the same way.

Output:

Nested HTML Elements Output

Nested HTML Elements

The HTML Tags in nested form constitute the web pages that we see on our browsers and hence it is very important to keep in mind the opening and closing of the tags. The closing tag defines the end of the effect of that particular tag. In the image shown below we have used connecting lines to show the usage of Nested HTML tags:

Nested Tags

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.