<td> sizing help

Discussion in 'HTML & Website Design' started by lapoo, Feb 20, 2008.

  1. #1
    my problem is in sizing the td
    i've created a table

    <table width="400" border="1">
      <tr>
        <td valign="top">dkmd</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="200">eeeeeeeeeeeefffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    Code (markup):
    If i've defined a
    <table width="400" border="1">
      <tr>
        <td valign="top">dkmd</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="200">eeeeeeeeeeeefffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    HTML:

    I want that cell don't expand and it remain 200px even if I've to lose the word
    Coul anyone help me? thanks
     
    lapoo, Feb 20, 2008 IP
  2. Ascendancy

    Ascendancy Active Member

    Messages:
    1,721
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Well why don't you try editing it with CSS? I'm not sure exactly where your problem lies, but you could make a rule targeting either every single <td>, or give it a class and do it that way, and then set the width, min-width, and max-width to 200px. If you don't understand css, try giving the other <td> a set with to split the difference, or give all of the <tr>'s specific widths.
     
    Ascendancy, Feb 20, 2008 IP
  3. portmaccer

    portmaccer Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK, try this:

    <style type="text/css">
    <!--
    .overflow {
    overflow: hidden;
    width: 200px;
    }
    -->
    </style>

    <body>
    <table width="400" border="1">
    <tr>
    <td valign="top">dkmd</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td width="200"><div class="overflow">eeeeeeeeeeee - I shortened this just for the display here - add your content fully</div></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
     
    portmaccer, Feb 20, 2008 IP
  4. bquast

    bquast Active Member

    Messages:
    275
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #4
    or start to use divs, easier to understand, I could never understand tables and plus if you want semantically correct code depending if you are putting tubular data in that table or not then divs are the right choice.
     
    bquast, Feb 20, 2008 IP
  5. richer2004

    richer2004 Guest

    Messages:
    406
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <table style=word-break:break-all CELLSPACING=0 CELLPADDING=0 WIDTH=180 align=center><tr><td VALIGN=top >1</td></tr></table>
     
    richer2004, Feb 21, 2008 IP
  6. tokyojoe66

    tokyojoe66 Guest

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I agree with bquast, ditch tables. Divs are much more flexible and easier to manipulate.
     
    tokyojoe66, Feb 21, 2008 IP
  7. portmaccer

    portmaccer Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    There is nothing wrong with using tables or tables and divs or just divs to make a site. Show me a site held together entirely with divs and I'll show you a site which more than likely doesn't behave really good in some browsers.

    It's all very good to preach about divs, but only very skilled coders can solve all the CSS issues to be sure it will hold together properly in most browsers.

    Pages coded to standards will validate whether they use tables or not.

    Use the tools that are right for the job.
     
    portmaccer, Feb 21, 2008 IP
  8. lapoo

    lapoo Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thanks for the answer but the problem persist. the problem is the unique word

    fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
    Code (markup):
    with many character and no space couse If I've

    ffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffff fffffffffffffff
    Code (markup):
    with spaces
    there are no problem

    I've read somewhere the solution is to use the word-break suggested by ricer but It's supported only by IE.
    I've to wait the CSS3 to implement
    anyway for the future use of the post i believe it's a useful lik to problem
    http://www.w3.org/TR/css3-text/#word-break
    http://www.w3.org/TR/css3-text/#word-break

    If anyone knows more thanks
     
    lapoo, Feb 21, 2008 IP
  9. portmaccer

    portmaccer Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    lapoo, did you try my solution as shown above?

    The table with the DIV in it as shown above does work. No matter how long the single word (no spaces) is, the TD is wrapped at 200 px.

    :)
     
    portmaccer, Feb 21, 2008 IP
  10. SinanCan

    SinanCan Peon

    Messages:
    132
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    <style type="text/css">
    <!--
    .overflow {
    overflow: hidden;
    width: 200px;
    }
    -->
    </style>

    <body>
    <table width="400" border="1">
    <tr>
    <td valign="top">dkmd</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td width="200"><div class="overflow">----- I shortened this just for the display here - add your content fully</div></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
     
    SinanCan, Feb 21, 2008 IP
  11. bquast

    bquast Active Member

    Messages:
    275
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #11
    or try

    <td style="width: 200px">
    HTML:
    that might work as well good sir,
    Brett
     
    bquast, Feb 21, 2008 IP