View Full Version : Height Issues in td Cells

10-26-2007, 04:17 AM
I have a table with several rows and cells. I can set the width, but the height gets messed up. It seems to be adjusting to the size of the text, even if it's smaller than the set width. Is there any way to fix this? Or maybe a way to prevent the browser from collapsing empty cells (because I could just replace the text with background images)?

10-26-2007, 08:41 AM
Can you give an example?

10-26-2007, 12:34 PM
Here's a link to the page I'm having trouble with (it's actually a minesweeper game): http://www.pehjota.com/storage/minesweeper/minesweeper1.html

The table that I'm having trouble with is created in the createField function in the JavaScript. The td tags all have a class attribute of "field". The height is supposed to be 16px, but it's not. You can also click Solve at the top to see the JavaScript change the contents and border widths of these cells. I have tried to compensate for the change in border width by changing the cells' widths and heights at the same time. The width works perfectly, but the height doesn't change (everything just moves up because the borders get smaller) and the whole table gets messed up.

10-26-2007, 03:44 PM
When you are using the width option make your width like this <width=50%> it will increase the size of the column.

10-26-2007, 09:37 PM
...I used CSS to do that. And I used pixels instead of % because I know the exact size I want everything to be.

Besides, that's not the issue here. I'm having problems with height, not width.

Does anyone have any idea why the browser is setting the height of the td's based on the font size instead of the actual height I set?