Skip to content
- Tutorials
- Python Tutorial
- Taking Input in Python
- Python Operators
- Python Data Types
- Python Loops and Control Flow
- Python Functions
- Python OOPS Concept
- Python Data Structures
- Python Exception Handling
- Python File Handling
- Python Exercises
- Java
- Java Programming Language
- Java Collections
- Java 8 Tutorial
- Java Programs
- Java Interview Questions
- Java Exercises
- Java Quiz
- Java Projects
- Advance Java
- Programming Languages
- System Design
- Interview Corner
- Computer Science Subjects
- DevOps
- Linux
- Software Testing
- Databases
- Android
- Excel
- Mathematics
- Python Tutorial
- DSA
- Data Structures
- Algorithms
- Analysis of Algorithms
- Searching Algorithms
- Sorting Algorithms
- Greedy Algorithms
- Dynamic Programming
- Graph Algorithms
- Pattern Searching
- Recursion
- Backtracking
- Divide and Conquer
- Mathematical Algorithms
- Geometric Algorithms
- Bitwise Algorithms
- Randomized Algorithms
- Branch and Bound
- Algorithms Tutorial
- DSA Tutorial
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- Language Wise Coding Practice
- Curated DSA Lists
- Competitive Programming
- Company Wise SDE Sheets
- DSA Cheat Sheets
- Top Interview Questions
- Puzzles
- Data Science
- Web Tech
- Courses
-
Last Updated : 19 Feb, 2024
Summarize
Comments
Improve
A nested list in HTML is a list that contains other lists within its list items. This creates a hierarchical structure, where each sublist is indented to visually represent its relationship to the parent list item. It’s commonly used for organizing and presenting information in a structured manner, enhancing readability and clarity of content.
Table of Content
- Nested Unordered List in HTML
- Nested Ordered List in HTML
Nested Unordered List in HTML
An unordered list in HTML is a collection of items represented by bullet points, providing a flexible way to display information without a specific order.
Approach:
- Use the <ul> tag to create an unordered list.
- Utilize the <li> tag to list individual items within the <ul> tag.
- The <ul> tag serves as the parent container for <li> tags, establishing the structure of the list.
- Nested lists can be created by placing additional <ul> or <ol> tags within <li> tags, enabling the creation of hierarchical structures.
Example: Implementation to create a nested unordered list.
HTML
<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0"
>
<
title
>Nested Unordered List</
title
>
<
style
>
</
style
>
</
head
>
<
body
>
<
ul
>
<
li
>
<
h2
>Frontend</
h2
>
<
ul
>
<
li
>HTML</
li
>
<
li
>CSS
<
ul
>
<
li
>onsubmit Attribute</
li
>
<
li
>onclick Attribute</
li
>
</
ul
>
</
li
>
<
li
>JavaScript</
li
>
</
ul
>
</
li
>
<
li
>
<
h2
>Library/Framework</
h2
>
See Also[HTML] - Can you put a span inside a paragraph in HTML?HTMLTag - GeeksforGeeks Common nesting issues in HTML - HTMHellBasics of Div Tags<
ul
>
<
li
>ReactJS
<
ul
>
<
li
>Hoisting</
li
>
<
li
>Props</
li
>
</
ul
>
</
li
>
</
ul
>
</
li
>
</
ul
>
</
body
>
</
html
>
Output:
Nested Ordered List in HTML
In HTML, an ordered list organizes items in a numbered sequence, providing a structured way to present information.
Approach:
- Use the
<ol>
tag to create an ordered list. - Employ the
<li>
tag to list individual items within the<ol>
tag, which are automatically numbered. - The
<ol>
tag acts as the parent container for<li>
tags, defining the sequential order of the list. - To create nested ordered lists, nest additional
<ol>
<ul>
tags within<li>
tags, facilitating the creation of hierarchical lists.
Example: Implementation to create a nested ordered list.
HTML
<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0"
>
<
title
>Nested Ordered List</
title
>
<
style
>
</
style
>
</
head
>
<
body
>
<
ol
>
<
li
>Subjects</
li
>
<
ol
>
<
li
>Mathematics</
li
>
<
li
>Science</
li
>
<
li
>Literature</
li
>
</
ol
>
<
li
>Programming Languages</
li
>
<
ol
>
<
li
>C</
li
>
<
li
>Java</
li
>
<
li
>Python</
li
>
<
li
>Ruby</
li
>
<
li
>Swift</
li
>
</
ol
>
<
li
>Computer Science Concepts</
li
>
<
ol
>
<
li
>Data Structures</
li
>
<
li
>Algorithms</
li
>
<
li
>Operating Systems</
li
>
<
li
>Database Management</
li
>
<
li
>Networking</
li
>
</
ol
>
<
li
>Web Technologies</
li
>
<
ol
>
<
li
>HTML</
li
>
<
li
>CSS</
li
>
<
li
>JavaScript</
li
>
<
ol
>
<
li
>React</
li
>
<
li
>Angular</
li
>
<
li
>Vue</
li
>
</
ol
>
<
li
>Bootstrap</
li
>
</
ol
>
</
ol
>
</
body
>
</
html
>
Output:
Please Login to comment...
Similar Reads
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> or <ol> element as a child of the <li
2 min read
Can we Create a Nested Form in HTML ?
In HTML nesting forms means placing one <form> element inside another is not allowed, although, multiple forms can be possible to create. The HTML specification explicitly specifies that forms cannot be nested. Nesting forms can lead to unexpected behavior and conflicts between forms. As a result, web browsers do not support the nesting of fo
3 min read
React.js Blueprint HTML Elements Component Nested Usage
React.js Blueprint is a front-end UI toolkit. It is very optimized and popular for building interfaces that are complex data-dense for desktop applications. We can add styles and the features of React.js BluePrint HTML elements Component to the HTML elements just by providing a className {Classes.RUNNING_TEXT} to the parent element, which will cha
2 min read
How to Create Nested tables within tables in HTML ?
HTML tables are very helpful in structuring the content in the form of rows and columns. But sometimes there is a need to add a table within a table. HTML supports this functionality and is known as the nesting of the tables. Tables can be nested together to create a table inside a table. To create a nested table, we need to create a table using th
3 min read
Design a Nested Chat Comments using HTML CSS and JavaScript
In this article, we will learn how to create Nested Comments using JavaScript. We must have seen it on social media like Facebook, Instagram, Youtube, Twitter, etc. We have seen the use of the nested comment in the comment section of these social sites. Approach: Create a folder nested-comments on your local machine and go to that folder.Create 3 f
2 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 methods to create a nested webpage. Table of Content Us
2 min read
How to Align Columns in Nested HTML using CSS Grid?
We can easily Align columns in nested HTML structures using a CSS grid. There are different approaches to do this such as Simple Nested Grid Alignment, Aligning Nested Grids with Specific Columns, and Responsive Nested Grids. Each approach serves different design needs, from basic grid layouts to more precise column alignments and responsive design
4 min read
PHP break (Single and Nested Loops)
In PHP break is used to immediately terminate the loop and the program control resumes at the next statement following the loop. Method 1: Given an array the task is to run a loop and display all the values in array and terminate the loop when encounter 5. Examples: Input : array1 = array( 1, 2, 3, 4, 5, 6, 7 ) Output : 1 2 3 4 Loop Terminated The
2 min read
How to break nested for loop using JavaScript?
The break statement, which is used to exit a loop early. A label can be used with a break to control the flow more precisely. A label is simply an identifier followed by a colon(:) that is applied to a statement or a block of code. Note: there should not be any other statement in between a label name and associated loop. Example-1: Break from neste
3 min read
JavaScript Nested Classes
Let us try to understand, what is class. A class in JavaScript is a type of function, which can be initialized through both function keywords as well as through class keywords. In this article, we will cover the inner class in javascript through the use of a function keyword. Here's an example of the class using the function keyword. Example: C/C++
3 min read
How to create Nested Accordion using Google AMP amp-accordion?
Introduction: Sometimes we have a lot of content to display and to make the website look pretty and short we make use of the collapsible textboxes. Collapsible textboxes are that division which is the combination of heading and content, generally only heading is visible but when it is hit the content is displayed. Setup: You have to import amp-acco
3 min read
How to filter nested JSON object to return certain value using JavaScript ?
Given a collection that contains the detail information of employees who are working in the organization. We need to find some values from that nested collections of details. That collection is known as the JSON object and the information inside object are known as nested JSON object. Example 1: We create the nested JSON objects using JavaScript co
4 min read
How to align nested form rows using Bootstrap 4?
Bootstrap is a CSS framework used to design web pages. Bootstrap along with HTML and JavaScript results in interactive web designs. The most recent release is Bootstrap v4.5. Bootstrap has a variety of components and utilities. The Bootstrap components include the form component. Bootstrap has an inbuilt form control class that is used to create fo
4 min read
How to enable or disable nested checkboxes in jQuery ?
In this article, we will see how to enable or disable nested checkboxes in jQuery. To do that, we select all child checkboxes and add disabled attributes to them with the help of the attr() method in jQuery so that all checkboxes will be disabled. Syntax: // Select all child input of type checkbox // with class child-checkbox // And add the disable
2 min read
How to update nested state properties in ReactJS?
There are the following approaches to update nested state properties in ReactJS: Approach 1: We can create a dummy object to perform operations on it (update properties that we want) then replace the component's state with the updated object.Approach 2: We can pass the old nested object using the spread operator and then override the particular pro
2 min read
PHP - MySQL : Nested Query
In this article, we are going to perform nested query operations on the database in the MySQL server using the Xampp server. Introduction : PHP stands for hypertext preprocessor, which is a server-side scripting language and also used to handle database operations. We are a PHP xampp server to communicate with the database. The language used is MyS
5 min read
What are nested rules in LESS ?
In this article we will learn about nested rules in Less, We can very easily define nested rules in LESS. Nested rules are defined as a set of CSS properties that allow the properties of one class to be used for another class and contain the class name as its property. In LESS, you can use class or ID selectors to declare mixin in the same way as C
3 min read
What is Routing and Nested Routing in Angular 9/8 ?
In this article, we will learn the routing & nested routing concept in Angular. We will implement the concept to establish routing between different components by making their routes when a user clicks the link, it will be navigated to a page link corresponding to the required component. Let's understand the routing in Angular. Routing: Angular
5 min read
Semantic-UI Nested Segments Group
Semantic UI is an open-source development framework that provides pre-defined classes to make our website look beautiful, amazing, and responsive. It is similar to Bootstrap which has predefined classes. It uses jQuery and CSS to create the interfaces. It can also be directly used via CDN like bootstrap. A Segment is used to group similar content w
2 min read
How to create nested controllers in Angular.js ?
A controller in AngularJS is a JavaScript object created with the help of a JavaScript object constructor. A controller can contain properties and functions. Controllers are used for controlling the application data of an AngularJS application. In this article, we will see the nested controllers in AngularJS and will understand their implementation
4 min read
Foundation CSS Menu Nested Style
Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails to look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is b
2 min read
How to replace text after a nested tag in jQuery ?
In this article, we will see how to replace text after a nested tag using jQuery. There is one main approach that can be followed. Approach: We use the click(), contents() and filter() methods and this, nodeType and nodeValue properties. There is one division element with an id of outer-tag with a span tag with a class of nested-tag nested within i
2 min read
Foundation CSS Reveal Nested Modal
Foundation CSS is an open-source and responsive front-end framework created by ZURB in September 2011 that makes it simple to create stunning responsive websites, apps, and emails that operate on any device. Many companies, like Facebook, eBay, Mozilla, Adobe, and even Disney, use it. This framework is based on bootstrap, which is similar to SaaS.
3 min read
Primer CSS Nested Link
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, an
2 min read
Foundation CSS Nested Off-Canvas
Foundation CSS is a free and open-source front-end framework for generating flexible web designs. With a responsive grid, HTML and CSS UI components, templates, and more, it's one of the most powerful CSS frameworks. It also contains a number of JavaScript extension capabilities that may be turned on or off. Thanks to the integration of the Fastcli
5 min read
How to append new information and rethrowing errors in nested functions in JavaScript ?
In this article, we will see how we may append new information and rethrow errors in nested functions in JavaScript with the help of certain theoretical explanations & understand them through the illustrations. This article is divided into 2 sections, i.e. in the 1st section, we'll understand how to append the new information while throwing an
5 min read
Angular PrimeNG Splitter Nested Panels
Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the Splitter Nested Panels in Angular PrimeNG. We will also learn about the properties, events & styling
4 min read
Less.js Extending Nested Selectors
LESS is a simple CSS pre-processor that makes it possible to create manageable, customizable, and reusable style sheets for websites. LESS is a dynamic style sheet language that increases the working power of CSS. LESS is cross-browser compatible. CSS pre-processor is a scripting language that improves CSS and gets compiled into regular CSS syntax
2 min read
How to create an array with multiple objects having multiple nested key-value pairs in JavaScript ?
In this article, we will learn to create an array with multiple objects having key-value pairs, we will use nesting which means defining another array in a pre-defined array with key-value pairs. Suppose we have several arrays of objects means containing various key-value pairs where keys are uniquely identified now we have to add these arrays to a
3 min read
Implement Nested Routes in React.js - React Router DOM V6
Nested routes in React JS are implemented using the outlet in React Router Dom. Routing in React not only provides routing for the pages but also for switching the content inside that page. Nested routes implement this by defining Routes for Child components inside parent route components. Prerequisites: React JSReact RouterReact Router DomApproach
4 min read
Article Tags :
Trending in News
- OpenAI o1 AI Model Launched: Explore o1-Preview, o1-Mini, Pricing & Comparison
- How to Merge Cells in Google Sheets: Step by Step Guide
- How to Lock Cells in Google Sheets : Step by Step Guide
- PS5 Pro Launched: Controller, Price, Specs & Features, How to Pre-Order, and More
- #geekstreak2024 – 21 Days POTD Challenge Powered By Deutsche Bank
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `
${comment_text}
`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `
${suggest_val}
`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `
Thank You!
Your suggestions are valuable to us.
You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.
`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });
Continue without supporting 😢