Search code examples
csswidthcss-tables

How to CSS style a table such that its width is within [min, max] percent of page width and as wide as necessary?


How to CSS style a table such that

  1. its width is at the most 80% of page width, and,

  2. is at the least 50% of the page width, and

  3. is as wide as necessary?


Solution

  • Use min-width and max-width

    min-width: 50%;
    max-width: 80%;