3

I have this markup for mobile.

<table>
<tr>
<td style="width:60%">
<div class="ellipsis">
Test bla bla
</div>
</td>
<td style="width:40%">
</td>
</tr>

CSS

.ellipsis { 
width : 100%;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
word-break: break-all;
word-wrap: break-word;
}

The truncation doesn't work as desired, instead the column expands depending on content.

Table-Layout : fixed makes both the columns equal.

Any suggestions ? Thanks.

3
  • 1
    My advice is to not use a table. Commented Jun 20, 2012 at 22:10
  • Yep, Brett. After lots of searching and all, I dropped table and using ul, it works like charm. Commented Jun 22, 2012 at 17:58
  • 2
    Can I get a point for my comment? :P Commented Jun 22, 2012 at 19:18

1 Answer 1

5

Please use the following css to make css3 truncation work with tables

table {
   width: 200px; /*specify a width*/
   table-layout:fixed;
}

The property "table-layout:fixed" seems important to work text truncation for any block level elements inside a table.

Sign up to request clarification or add additional context in comments.

1 Comment

table-layout:fixed; is making the columns equal in size if width is given in %. Even the table width is in %, fluid design.

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.