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.

sandeep
  • 91,313
  • 23
  • 137
  • 155
Rakesh
  • 5,793
  • 8
  • 36
  • 37

1 Answers1

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.

Hirak
  • 86
  • 2
  • table-layout:fixed; is making the columns equal in size if width is given in %. Even the table width is in %, fluid design. – Rakesh Jun 20 '12 at 11:24