How to set the table layout algorithm using CSS ? Last Updated : 24 May, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report You can set the table layout algorithm using table-layout property which is used to display the layout of the table. In this article, you learn both auto and fixed layout algorithms to form table. Syntax: table-layout: auto|fixed; Approach 1: Using auto layout algorithm. Note: In the auto-layout algorithm, the browser expands the rows or columns to accommodate the larger bit of content, so that content doesn't overflow. Here Browser needs to analyze the entire table’s content. which can be a little bit slow processing layout. Example: In this example, we are using the above-explained approach. HTML <!DOCTYPE html> <html> <head> <style> table { border-collapse: collapse; border: 3px solid black; } th, td { border: 2px solid green; } table#gfg { table-layout: auto; width: 200px; } div { max-width: 200px; padding: 10px; border: 5px solid green; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2>table-layout property</h2> <div> <h3>table-layout:auto;</h3> <table id="gfg"> <tr> <th>Author Name</th> <th>Age</th> <th>College</th> </tr> <tr> <td>Aman Rathod</td> <td>20</td> <td>NCE</td> </tr> <tr> <td>Ranveer Sequeira</td> <td>19</td> <td>Google</td> </tr> </table> </div> </center> </body> </html> Output: Approach 2: Using fixed layout algorithm. Note: In a fixed layout algorithm, Browser uses the first row to determine the column widths and does not need to analyze the entire table’s content. So it is a faster processing layout. Example: In this example, we are using the above-explained approach. HTML <!DOCTYPE html> <html> <head> <style> table { border-collapse: separate; border: 3px solid black; } th, td { border: 2px solid green; } table#table1 { table-layout: fixed; width: 200px; } div { max-width: 200px; padding: 10px; border: 5px solid green; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2>table-layout property</h2> <div> <h3>table-layout:Fixed;</h3> <table id="table1"> <tr> <th>Author Name</th> <th>Age</th> <th>College</th> </tr> <tr> <td>Aman Rathod</td> <td>20</td> <td>GeeksforGeeks</td> </tr> <tr> <td>Ranveer Sequeira</td> <td>19</td> <td>Google</td> </tr> </table> </div> </center> </body> </html> Output: Comment More infoAdvertise with us Next Article How to set the table layout algorithm using CSS ? A aksrathod07 Follow Improve Article Tags : Web Technologies CSS CSS-Properties CSS-Questions Similar Reads How to create the tabular layout using CSS Property ? Tabular layouts are a common requirement for web developers when designing websites. Traditionally, tables were used to create these layouts, but with the advent of CSS, developers now can use more modern approaches like flexbox and grid. This article will discuss how to create tabular layouts using 4 min read How To Set Alternate Table Row Color Using CSS? To set alternate table row colors, we can use the :nth-child() pseudo-class in CSS. This technique helps improve the readability of a table by making it easier to differentiate between rows. In this article, we'll cover how to set alternate row colors using the :nth-child() pseudo-class and provide 3 min read How to Change the Background Color of Table using CSS? Changing the background color of a table using CSS can help improve the visual appearance of a website or web application. we will learn how to change the background color of the table using CSS with different approaches.These are the following approaches:Table of Content Using Inline CSSUsing Inter 2 min read What are the usage of "table-layout" property in CSS ? In this article, we are going to learn the usages of the table-layout property in CSS, The table-layout property in CSS specifies the layout of the table which consists of table cells, rows, and columns. It can have two values: "auto," which allows the table to adjust its layout based on content, an 3 min read How to set the table cell widths to minimum except last column using CSS ? Tables are widely used for showing the data and sometimes we get into a scenario where we need some special kind of styling over the rows or the cells. We will explore one case where we must make the last column dynamic using CSS and the rest taking the required width.These are the following approac 3 min read Like