What is nesting of list & how to create the nested list in HTML ? Last Updated : 14 May, 2024 Comments Improve Suggest changes Like Article Like Report Nesting of lists in HTML involves placing one list within another list item, creating a hierarchical structure. This is done by embedding a <ul> (unordered) or <ol> (ordered) list inside an <li> (list item) element. The proper way to make a nested HTML list is to use the <ul> or <ol> element as a child of the <li> element it belongs to. Note: The <ul> attributes are not supported by HTML5. Table of Content Nested Unordered List in HTML: Nested Ordered List in HTML: Nested Unordered List in HTML: A nested unordered list in HTML creates a hierarchical structure by placing a <ul> element inside an <li> of another <ul>. This allows for sublists within main list items, The list items are marked with bullets i.e small black circles by default. Syntax: <ul> ....</ul>Attribute values: Attribute Values Description compact It will render the list smaller. type It specifies which kind of marker is used in the list. Example: This example shows a nested unordered list. It is used to nest the list items i.e list inside another list. HTML <!DOCTYPE html> <html> <head> <title>Nested Unordered List in HTML</title> </head> <body> <h2>Nested Unordered List</h2> <p>GeeksforGeeks courses list:</p> <ul> <li>DSA <ul> <li>Array</li> <li>Linked List</li> <li>Stack</li> <li>Queue</li> </ul> </li> <li>Web Technologies <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </li> <li>Aptitude</li> <li>Gate</li> <li>Placement</li> </ul> </body> </html> Output: Nested Unordered List in HTML Example Output Nested Ordered List in HTML: Nested ordered lists in HTML organize content hierarchically, where each sublist is numbered sequentially. By embedding <ol> elements within <li> elements, sublists are created within main list items, The list items are marked with numbers by default. Â Syntax: <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol> Attribute values:Attribute Values Description compact It defines the list should be compacted (compact attribute is not supported HTML5. Instead use CSS). reversed It defines that the order will be descending. start It defines the starting number or alphabet for the order list. type It defines which type (1, A, a, I, and i) of the order you want in your list numeric, alphabetic, or roman numbers. Example: In this example, we will show a nested ordered list with help of a HTML document. HTML <!DOCTYPE html> <html> <head> <title>Nested Ordered List in HTML</title> </head> <body> <h2>Nested Ordered List</h2> <ol> <li>Coffee</li> <li> Tea <ol> <li>Black tea</li> <li>Green tea</li> </ol> </li> <li>Milk</li> </ol> </body> </html> Output: Nested Ordered List in HTML Example Out Comment More infoAdvertise with us Next Article Unordered, Ordered, and Description Lists in HTML G gottumukkala_sivanagulu Follow Improve Article Tags : HTML HTML-Tags HTML-Questions Similar Reads How to implement various types of lists in HTML ? HTML lists are used to display items in an organized format. There are three types: unordered lists(<ul>), which use bullets; ordered lists (<ol>), which use numbers; and definition lists (<dl>), which pair terms with descriptions. Each type serves specific purposes.HTML lists allo 4 min read What is nesting of list & how to create the nested list in HTML ? Nesting of lists in HTML involves placing one list within another list item, creating a hierarchical structure. This is done by embedding a <ul> (unordered) or <ol> (ordered) list inside an <li> (list item) element. The proper way to make a nested HTML list is to use the <ul> 3 min read Unordered, Ordered, and Description Lists in HTML Lists are used to store data or information in web pages in ordered or unordered form. HTML supports several types of list elements that can be included in the <BODY>tag of the document. These elements may also be nested, i.e., the onset of elements can be embedded within another. There are th 5 min read How to Create an Unordered List in HTML ? An unordered list in HTML is a collection of items displayed with bullet points. To create an unordered list, we can use the <ul> tag to start the list and <li> tags for each items. Unordered lists are usually displayed with bullet points. Syntax<ul> <li>apple</li> < 1 min read How to create a nested webpage in HTML ? When the content of one completely different webpage is embedded into another webpage, it is called a nested webpage. In simple words, a webpage that is inside another webpage of a completely different domain. In this article, we are going to learn how to create a nested webpage. There are two metho 2 min read How to define a list item in HTML5? To define a list in HTML5 we can use the HTML <li> tag. But there are two types of listing in HTML. One is an ordered list and another one is an unordered list. For ordered we can use HTML <ol> tag and for the unordered list, we will use the HTML <ul> tag. Also, we can change the l 2 min read How to set list in descending order in HTML5 ? HTML Lists are used to create informative lists. Any list will have one or more list items. We have three types of lists in HTML. ul: An unordered list is referred to as an ul. Simple bullets would be used to list the items.ol: A number that is arranged in a certain order. This will list the items u 2 min read How to create a list with roman number indexing in HTML ? Roman numeral indexing in HTML lists employs Roman numerals (I, II, III, etc.) for item markers. This can be achieved by specifying the type attribute of the <ol> tag as "I", "i", "A", "a", "I", or "i", or by manually numbering list items with Roman numerals. This guide provides all approaches 2 min read How to specify the kind of marker to be used in the list in HTML5 ? There are two types of lists in HTML, the first is an ordered list which is created using the <ol></ol> tag, and the second is an unordered list which is created using the <ul></ul> tag. Both of the lists should have a <li></li> tag to represent the data inside th 3 min read What is the way to keep list of elements straight in HTML file ? In this article, we will discuss various methods to keep the list of elements straight in an HTML file. Generally, The proper indented content in the browser makes the content well-organized & structured, enhancing the overall readability, along with increasing the interactivity of the website. 6 min read Like