I need to create tables dynamically in Javascript, with column widths of 20%, 55%, 15%, 10%.
I can't figure out how to make this work.
I created css classes for each of the four columns.
My css style sheet which, in part, looks like:
The Javascript function I wrote creates the following table:
but the table so created
does not follow the width instructions specified.
Is there something wrong with my syntax?
Or is there another way, when creating a table in Javascript,
to specify the width of the columns
(well, cells, because I am not using <col>).
Thanks muchly.
David
I can't figure out how to make this work.
I created css classes for each of the four columns.
My css style sheet which, in part, looks like:
Code:
table{
font-family: Arial;
text-align: left;
border-collapse:collapse;
table-layout:fixed;
}
.col1{width:20%;}
}
.col2{width:55%;}
}
.col3{width:15%;}
}
.col4{width:10%;}
}
.current_goals
{border: thin solid black;
border-collapse:collapse;
text-align: left;
width: 100%;
border:1px;
cellpadding:1px;
cellspacing:1px;
contenteditable:"true";
}
Code:
<table id="risknew0" class="current_goals"> <tbody> <tr> <td class="col1"> </td> <td class="col2"> </td> <td class="col3"> </td> <td class="col4"> </td>< /tr> </tbody> </table>
does not follow the width instructions specified.
Is there something wrong with my syntax?
Or is there another way, when creating a table in Javascript,
to specify the width of the columns
(well, cells, because I am not using <col>).
Thanks muchly.
David
Comment