javascript - How can I change a table's column widths? -
i have large table need include in prototype. how change column widths? attempts using css have not worked.
http://jsbin.com/lebokewi/1/edit?html,css,output
css
table, th, tr, td { border: 1px solid #000; } #colhdr th:nth-of-type(1) {width: 100px;} #colhdr th:nth-of-type(2) {width: 50px;} #colhdr th:nth-of-type(3) {width: 200px;} #colhdr th:nth-of-type(4) {width: 60px;} #colhdr th:nth-of-type(5) {width: 80px;}
try using <col> width attribute:
example
<table> <col width="130"> <col width="80"> <tr> <th>month</th> <th>savings</th> </tr> <tr> <td>january</td> <td>$100</td> </tr> <tr> <td>february</td> <td>$80</td> </tr> </table>
reference
w3schools.com
Comments
Post a Comment