Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder thesmart1's Avatar
    Join Date
    Dec 2005
    Posts
    369
    Thanks
    7
    Thanked 3 Times in 3 Posts

    Height Issues in td Cells

    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)?

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    Can you give an example?

  • #3
    Regular Coder thesmart1's Avatar
    Join Date
    Dec 2005
    Posts
    369
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Here's a link to the page I'm having trouble with (it's actually a minesweeper game): http://www.pehjota.com/storage/mines...esweeper1.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.

  • #4
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When you are using the width option make your width like this <width=50%> it will increase the size of the column.

  • #5
    Regular Coder thesmart1's Avatar
    Join Date
    Dec 2005
    Posts
    369
    Thanks
    7
    Thanked 3 Times in 3 Posts
    ...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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •