SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Table keeping to its width value...

    Hi all,

    I have a table, or table cell even, and I'd like it to remain at a width that is specified in the 'width' attribute or the <table> or <td>, but if I insert content, for example one massive continuous link, then it breaks the width.

    Is there any way a table or cell can keep to its width without breaking?

    Cheers

    Tryst

  2. #2
    SitePoint Addict
    Join Date
    Jul 2000
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try this css style, which forces a break in the middle of the link, but I believe this a non-standard IE-only attribute:

    word-wrap:break-word;

  3. #3
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So this would break a word at the point when it reaches the table or cell border?

    Tryst

  4. #4
    SitePoint Addict
    Join Date
    Jul 2000
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I just tried it out, but it only works in IE:
    HTML Code:
    <table border="1">
    <tr>
    <td width="100" style="word-wrap:break-word;">http://www.domain.com/long_url/long_url/</td>
    </tr>
    </table>

  5. #5
    SitePoint Addict
    Join Date
    Jul 2000
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just remembered, as an alternative, you could use the overflow attribute to add horizontal scrollbars. This is standard css:
    HTML Code:
    <div style="width:100px;overflow:scroll;">http://www.domain.com/long_url/long_url/</div>

  6. #6
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So a scrollbar would appear in a table cell?

    Cheers

    Tryst

  7. #7
    SitePoint Addict
    Join Date
    Jul 2000
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Applying the overflow attribute directly to the td doesn't seem to work. But applying it to a div within the td does:
    HTML Code:
    <table border="1">
    <tr>
    <td width="100"><div style="width:100px;overflow:scroll;">http://www.domain.com/long_url/long_url/</div></td>
    </tr>
    </table>


Bookmarks

Posting Permissions

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