[ACCEPTED]-Style CSS table td-css-tables

Accepted answer
Score: 11
td {
  width: 50px;

I think something like that might work for 8 you. Obviously, you can adjust the actual 7 width to your needs.

And if you multiple 6 table and only want to fix one, give the 5 one in question an id:

<table id="fixed_table">

and then in the css, you 4 could say:

#fixed_table td {
  width: 50px;

and it would only affect tds in 3 that particular table. Of course, if you 2 wanted to affect some tables but not others, you 1 would use a class instead of an id.

Score: 3

You could use a combination of width and max-width:

td {
    border: 1px solid #ccc;
    width: 2em; /* or whatever... */
    max-width: 2em; /* or whatever... */
    height: 2em; /* or whatever... */
    line-height: 2em; /* or whatever... */
    text-align: center; /* a personal aesthetic choice... */
    overflow: hidden; /* to prevent overflow... */

JS Fiddle demo.

(Please note that 3 while I use jQuery in the demo, that's only 2 to generate contents and isn't necessary 1 for the demo to work.)

Score: 2

Set fixed widths on the columns.


More Related questions