Reputation: 383
How can I prevent a table from being resized?
I change the content of the table with Ajax so I want the table to be fixed, not resized automatically as the content changes.
How can I do that?
Upvotes: 2
Views: 1267
Reputation: 3078
I have this suggestion please check it out. I'm not that good in css but I just thought that maybe a work-around would help. :)
Upvotes: 1
Reputation: 10047
Do it with CSS:
table td {
width: [somevalue];
height: [somevalue];
}
That way the cells will remain the same size even when the content is changed.
Upvotes: 1
Reputation: 98786
You can use the width
attribute on your table cells to fix their width.
You only have to use it on cells in the first row of your table; the browser will keep those widths for all the cells in the respective columns.
Alternatively, you can add a class
attribute to your table cells, and set their width i your stylesheet. If so, you might want to also apply table-layout: fixed
to your <table>
tag.
Upvotes: 2