I have an HTML table which has equally divided rows and columns. I would like each cell to be of a fixed size, say 40px width and 30px height. When I change the size of the browser window, the cells size changes also. How can I prevent it ? I would expect to see the scroll bars if browser's window become too small. Is that right to set the height and the width of the cell in pixels ? Thanks !
A:
Make sure that you are assigning width
and height
in pixels rather than percentage to the table as well as its cells and rows.
Sarfraz
2010-04-25 07:13:04
Isn't this enough to set the width and the height of the cells ? Why should I also set the width and the height of the table itself ?
Misha Moroshko
2010-04-25 07:16:23
A:
You have to specify the size of the table to prevent it from being adjusted to fit the page.
When you specify the size of the cells that is just a minimum size, they will get larger if the table is larger. Also, if you have specified the size for all cells, and the table is smaller than the sum of the cell sizes, the cells will have to get smaller than specified.
Guffa
2010-04-25 07:15:09
So in my case (where the table is equally divided into rows and columns), what would be the most easiest and efficient way to set a fixed cell size ? I understand that I must set table's size. What else is a must ? Can I specify once the width of a column and the height of a row, or I must specify the width and the height for each cell ? Thanks !
Misha Moroshko
2010-04-25 07:20:39