If the TD content is too large in table, it will be the TD support is very wide, it looks ugly.
If you can make the TD both Beautiful. You can see the full effect.
We then need to give the specified style before generating the TD:
This is achieved using jquery.
//after the page loads, set the. style. JQuery (function(){ //Use the ID selector, for example: Tab Object->tr->td object. $ ("#high_light tr TD"). each (function(i) {//gets the text of the current object of the TD, if the length is greater than 25; if($( This). Text (). length>25){ //set the Title property to TD and set the full value of TD. to the title property. $( This). attr ("title", $ ( This). text ()); //gets the value of the TD and intercepts it. Assigns a value to the text variable to save. vartext=$ ( This). Text (). substring (0,25) + "..."; //re-assign the TD value; $( This). text (text); } }); });
<HTML> <Head> <title>Test<title> </Head> <TableID= "High_light"> <TR> <TD>This is a long text content, test whether the normal interception. This is a long text content, testing whether the normal interception. This is a long text content, testing whether the normal interception. This is a long text content, testing whether to intercept normally. </TD> </TR> </Table> </HTML>
from:http://zhouhaitao.iteye.com/blog/1160694
jquery gets automatic truncation of long text content, displayed as ellipses