0
<table style="table-layout:fixed;">    
    <tr>
        <td width="221" style="overflow:hidden">
            //A very long text that meant to overflow
        </td>
    </tr>
</table>

After some research, the above code should works fine but it's not. It can only be achieved if there is an extra div tag with style overflow:hidden in td.

And another question is how to implement an overflow to height? Would be appreciate if any sample code can be provided.

5 Answers 5

1

You should specify more details to your object, like white-space, because the ling text is automatically wrap in td.

<table style="table-layout:fixed;">    
<tr>
    <td width="221" style="overflow:hidden;display:block;width:5em;white-space:nowrap;background-color:#ccc;">
        //A very long text that meant to overflow
    </td>
</tr>
Sign up to request clarification or add additional context in comments.

Comments

0

Adding white-space: nowrap; to the TD should solve it.

Demo: http://jsfiddle.net/cYAMm/

Comments

0

For controlling hight only u have to use the CSS property overflow-y in place of overflow. To apply scrolling u have to use overflow-y: scroll and similar to that of overflow for other such cases.

Comments

0

Working Demo Here

you can emulate overflow:hidden without alterate table-layout, just putting inside the TD two divs:

<div style="position: relative;">
  <div style="overflow: hidden; width: 320px; height: 150px;">

    content

  </div>
</div>

See yor code on JSFiddle

1 Comment

you don't need to add position absolute
0

if you want to have overflow for the specific width and height, you should add css property display:block to <td> and as others said before for width overflow you should set white-space:nowrap it prevent your text to be wrap ,this is a working example with overflow:scroll for better underestanging

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.