Buffon
Buffon

Reputation: 383

How to make table not be resized?

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

Answers (3)

Carls Jr.
Carls Jr.

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

Nick Brunt
Nick Brunt

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

Paul D. Waite
Paul D. Waite

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

Related Questions