How to display a list in n columns format ? Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report We can display a list in n columns format in two ways: Using Float in list Using column-count in list Using float in list: By using float, we can make list to float left, i.e. the next item which follows it will be displayed into left. So, here we set the size of ol as 30em and size of one list item as 10em thus only 3 items can accommodate in one line and forming three columns. To get the desired number of columns you can set the size of ol and size of one item accordingly. Example 1: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title> How to display a list in n columns format? </title> <!--CSS Code--> <style media="screen"> body{ background: orange; overflow: hidden; } h1 { text-align: center; color: green; } ol{ /* As width is 10 so it will create 3 columns */ width: 30em; /* Removes any style in list */ list-style: none; color: white; position: absolute; } ol li{ /* Makes the list to float left */ float: left; /* Size of one list item */ width: 10em; } br { clear: left; } /* Creates gap between two two columns */ div.wrapper { margin-bottom: 1em; } </style> </head> <body> <!-- HTML Code --> <h1>Geeks For Geeks</h1> <center> <div class="wrapper"> <ol> <li>Geek 1</li> <li>Geek 2</li> <li>Geek 3</li> <li>Geek 4</li> <li>Geek 5</li> <li>Geek 6</li> <li>Geek 7</li> <li>Geek 8</li> <li>Geek 9</li> <li>Geek 10</li> <li>Geek 11</li> <li>Geek 12</li> </ol> </div> </center> </body> </html> Output: Using column-count in list: Column-count in CSS helps you to decide the number of columns that you want in your output. Its value can be any positive integer. Here the example with two different values of n ( n = 6, n = 4). Example 2: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title> How to display a list in n columns format? </title> <!--CSS Code--> <style media="screen"> body{ background: dodgerblue; overflow: hidden; } h1 { text-align: center; color: green; } /* Here value of column-count can be any positive integer value */ ol.no_1{ /* Divides into 4 columns */ column-count: 4; /* Removes any style in list */ list-style: none; height: 300px; left:15%; color: white; position: absolute; } ol.no_2{ /* Divides into 6 columns */ column-count: 6; /* Removes any style in list */ list-style: none; height: 300px; top:35%; left:5%; color: white; position: absolute; } ol li{ /* It is the necessary statement as it makes it compactile with the height of ol */ display: inline-block; } </style> </head> <body> <!-- HTML Code --> <h1>Geeks For Geeks</h1> <div class="wrapper"> <!-- Class with n=4 --> <ol class="no_1"> <li>Geek 1</li> <li>Geek 2</li> <li>Geek 3</li> <li>Geek 4</li> <li>Geek 5</li> <li>Geek 6</li> <li>Geek 7</li> <li>Geek 8</li> <li>Geek 9</li> <li>Geek 10</li> <li>Geek 11</li> <li>Geek 12</li> </ol> <!-- Class with n=6 --> <ol class="no_2"> <li>Geek 1</li> <li>Geek 2</li> <li>Geek 3</li> <li>Geek 4</li> <li>Geek 5</li> <li>Geek 6</li> <li>Geek 7</li> <li>Geek 8</li> <li>Geek 9</li> <li>Geek 10</li> <li>Geek 11</li> <li>Geek 12</li> </ol> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Create an Unordered List in HTML ? A aditya_taparia Follow Improve Article Tags : HTML CSS-Misc HTML-Misc 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