user2324085
user2324085

Reputation: 63

CSS Break Long Text with "..."

Am trying to use text-overflow:ellipsis inside the <td> tag but it supports only to <div> tag.

Any idea to support for <td> tag?

check what am trying to do http://phpresult.com/source/share/L9F71379328772

Upvotes: 1

Views: 102

Answers (2)

Mohan Raj
Mohan Raj

Reputation: 457

I have Found the Solution by using max-width

<style> 
.test
{
white-space:nowrap; 
text-overflow:ellipsis;
max-width: 100px; 
overflow:hidden; 
border:1px solid #000000;
}
</style>
</head>
<body>
  <table border="1">
    <tr>
      <td class="test">
      This is the Long text only applied to div tag
      </td>
    </tr>
  </table>
</body>

Upvotes: 1

Kailash Ahirwar
Kailash Ahirwar

Reputation: 769

Add below code...

td {
  display: block; /* or inline-block */
}

or

Use

table-layout: fixed;

or give fixed width to your table

Upvotes: 0

Related Questions