CSS Properties: How to set the table layout algorithm
Solution:
HTML Code :
Explanation:
- This HTML document demonstrates how to set different table layout algorithms using CSS.
- CSS comments are added to explain each section of the code.
- The table selector sets properties for all tables, such as border-collapse and width.
- The td selector sets properties for all table cells, such as border.
- Two table classes are defined:
- .w3r1 sets the table layout algorithm to auto.
- .w3r2 sets the table layout algorithm to fixed.
- The width attribute in the td elements specifies the width of each table cell.
- The first table has its layout algorithm set to auto, and the second table has its layout algorithm set to fixed.
Live Demo :
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics