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
    New Coder
    Join Date
    Jul 2002
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clipping content on a table column

    How do I clip a table column data if it gets past a specific width? I tried specifying it's size through CSS, but nothing seems to work. A table's default behavior seems to be to expand to fit in long text.
    V

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you set overflow: hidden; in the style? Also use the clip style to set the maximum width and height.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    <html>
    <head>
    <title>untitled</title>
    <style type="text/css">

    .procrustean {
    width: 200px;
    overflow: hidden;
    background: tan;
    }

    td {
    background: pink;
    }

    </style>
    </head>
    <body>
    <table border="1">
    <tr>
    <td><span class="procrustean">blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah blah</span></td>
    <td>blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah</td>
    </tr>
    </table>
    </body>
    </html>

    Forcing text wrap is a whole other problem....

  • #4
    New Coder
    Join Date
    Jul 2002
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hum.... adios....
    Is it possible to still clip the data without having that span tag??? What I really need was to recreate that in the td tag....

    Basically, I'm working on an asp.net datagrid component, which when we bind data to, it automatically creates for us a table. I can set the styles and stuff inside the table,tr,td tags.... But creating a span tag inside each td tag as the control is binding data to it is something still out of my league......

    Thanks again,
    V

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Here's the problem I ran into: the standard behavior of a <td> is to display a line of text, regardless of any other directives, until whitespace is encountered; it won't break otherwise. A <span> is different - its 'procrustean' (little joke ) behavior is to truncate as ordered. Probably a workaround; I'd help you with the asp.net datagrid component, if I had any idea what that meant.


  •  

    Posting Permissions

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