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 4 of 4
  1. #1
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts

    clipping text to a certain width

    Is there anyway to clip text to a specified width?
    What I'm looking for is a way to take long text that doesn't wrap in a table (text without spaces, like email address) and have the table clip it to show only what will fit in the cell.

    I was thinking of having a DIV in the cell like so...
    <TD width="30%" >
    <DIV style="overflow:hidden">blah blah some long text</DIV>
    </TD>

    This seems kinda nasty to have in all the table cells, so I'm wondering if someone has a better idea
    Wayne Christian

  • #2
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    well, that didn't work... Any suggestions? I can't clip the text using jsp/java code since its the browser that determines the width of the table. Is there any fancy javascript function to clip text to a specified pixel width? See the sample bmp which illustrates the problem. The third row text does not wrap and causes the table cell to expand beyond its specified width
    Attached Images Attached Images
    Wayne Christian

  • #3
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    You need to fix the format of the table:

    <table style="table-layout:fixed">

    Then <td style="overflow:hidden"> should do the trick, though I think when table layout is fixed that the overflow default to hidden. As long as the columns have a width defined in pixels or percentages it should work.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&

  • #4
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    wonderful!!! That works perfectly. Thanx
    Wayne Christian


  •  

    Posting Permissions

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