Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Nested Lists
Nested Lists

Nested lists defines list inside an other list like you can place unordered list inside an other unordered list or you can place ordered list inside unordered list.

Syntax

<ul>
<li>Item 1</li>
<li>Item 2
<ul>
<li>Item 2.1</li>
<li>Item 2.2</li>
</ul>
</li>
<li>Item 3</li>
</ul>


You can use nested lists any where within an HTML document.


Example

  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.2
  • Item 3

Note:

You can create navigation bar or dropdown lists using nested lists.


Nested lists are pair tags and output of nested lists is lists of elements like you can see in above example.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Select your items
  • Create one ul list
  • Now add two items in ul list
  • Now Create an other ul list inside ul list
  • add two items in second ul list
  • Items names should be any as per your choice

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

  • Home
  • Profile
    • About
    • Contact

Nested lists are combination of ol lists, ul lists and dl lists.