top of page

HTML Basics (Nesting)

Writer's picture: Luna TechLuna Tech

In this section, we will cover HTML nesting.


What Does It Mean to Nest HTML Tags?


The easiest way to understand nesting is to think of HTML tags as boxes that hold your content. Your content can include text, images, and related media. HTML tags are the boxes around the content. Sometimes, you need to places boxes inside of other boxes. Those "inner" boxes are nested inside of others.

Essentially, nesting is the action of putting tags within other tags.


As you see in the diagram below, the <title> </title> tags are nested between the <head> </head> tags. This tells the web page to detect the title as a part of the head tags and must NOT show in the actual web page.


When nesting, indentation can be done using the Tab button.




What is the importance of nesting?


Nesting is used in all programming languages. Look at the python example below.




The example means the print statement is a part of the for loop.


Nesting also helps make your code more readable and organized.


You can watch the video below for a quick summary on HTML Nesting!







6 views0 comments

Recent Posts

See All

HTML Basics (Comments)

Hi students, In this section, we will cover the importance of adding comments in your HTML code. One of the most important aspects of...

Comentarios


bottom of page