PDA

View Full Version : Clipping content on a table column


Vermelh0
09-06-2002, 08:02 PM
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

Roy Sinclair
09-06-2002, 08:24 PM
Did you set overflow: hidden; in the style? Also use the clip style to set the maximum width and height.

adios
09-06-2002, 10:25 PM
<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">blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah</span></td>
<td>blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah</td>
</tr>
</table>
</body>
</html>

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

Vermelh0
09-07-2002, 01:42 PM
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

adios
09-08-2002, 12:50 AM
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 :o) 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.