-1

I want to know how to set a max-width css property to table (td and th tags).

This syntax doesn't work with me.

td,th{
   max-width:100px;
}
user_1330
  • 504
  • 1
  • 5
  • 22
fer sid
  • 31
  • 3
  • Possible duplicated question, https://stackoverflow.com/questions/8465385/how-can-i-set-the-max-width-of-a-table-cell-using-percentages – aUXcoder Jul 18 '19 at 15:12

2 Answers2

0

Just create a <div> inside of each <td> and/or <th> and give it the max-width that you want. get a look at my working codepen

JPeter
  • 219
  • 1
  • 14
-1

using table-layout: fixed :

table {
  max-width: 100px;
  table-layout: fixed;
}
user_1330
  • 504
  • 1
  • 5
  • 22