Is it possible to wrap text inside <td> ?

Discussion in 'HTML & Website Design' started by computerzworld, Nov 8, 2008.

  1. #1
    Hello,
    I am having problem while using text inside td. I want to wrap up the text automatically when td's width is exceeded. How is it possible using html or css? Please help me if anybody is having answer of it. Thanks in advance.
     
    computerzworld, Nov 8, 2008 IP
  2. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    should wrap automatically, but if not, try

    
    <td style="width:100px;"></td>
    
    Code (markup):
    Just change the 100px to whatever width you want, or use pt or em instead of px, whatever you prefer. Remember to make all the td's in the column the same width!
     
    dev_SeeInside, Nov 8, 2008 IP
  3. computerzworld

    computerzworld Active Member

    Messages:
    214
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thanks for the reply friend....
    I tried as you have said like this one...
    
    <table border="1" cellspacing="1" cellpadding="0">
      <tr>
        <td style="width:1px">abcasdfhiosdahfdiofdhsaiodfhfioaxyzsdaohfsdiaofhiodsafshfiofhaioffhdasiofhfisdoafhadfidofhafiosdafhafiodhsafisoadfhdiofashd</td>
      </tr>
    </table>
    HTML:
    But it doesn't wrap my text. Please help me. Thanks.
     
    computerzworld, Nov 8, 2008 IP
  4. parmesh.a@gmail.com

    parmesh.a@gmail.com Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It will not wrap as the text is in one sentence. if you keep some spaces in that sentence then it will wrap.
     
    parmesh.a@gmail.com, Nov 10, 2009 IP
  5. jimairon

    jimairon Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If your text has no spaces, some browsers will wrap the text and some other browsers will now wrap.

    What I suggest to do is to set a fixed width and to add style="overflow: hidden;". This will hide a part of the text, but it will not break the site layout.
     
    jimairon, Nov 11, 2009 IP