How to set the table layout algorithm using CSS ? Last Updated : 24 May, 2023 Comments Improve Suggest changes 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 ? 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 How To Style a Table with CSS? A table organizes data in rows and columns, making information easy to read and compare, like a spreadsheet or chart. To style a table with CSS, use properties like border for cell borders, padding for spacing, text-align for alignment, and background-color to color rows or headers for clarity.Appro 2 min read How To Place Tables Side by Side using HTML and CSS In this article, we will learn how to place tables side by side using HTML and CSS. To place tables side by side, first, we create two tables using <table> tag and then apply some CSS styles to place both tables side by side.Place Tables Side by SideExample: Here, we place two Tables Side by S 2 min read Space between two rows in a table using CSS The space between two rows in a table can be done using CSS border-spacing and border-collapse properties. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of the table is collapsed or not. The border-sp 1 min read How to arrange text in multi columns using CSS3 ? In many websites, content is often displayed in parallel stacks to present more information in a compact space, similar to how newspapers and books are formatted. This pattern helps display large amounts of content in a small area, making it easier to read. In this article, we will learn how to arra 4 min read How to create a table row using HTML? Define a row in a table by using a <tr> tag in a document. This tag is used to define a row in an HTML table. The tr element contains multiple th or td elements. Syntax:<tr> ... </tr>Example: In this example, a table row in HTML5, utilizes the <tr> tag within the <tbody 1 min read Like