user3770158
user3770158

Reputation: 389

Limit td max width for a long word, make down a line

Hi i couldn't find out how to do it.

I am trying to limit a table 'td', but in my situation the td can be one really long word(a file path...). So it does not go down a line...

Here is my fiddle: http://jsfiddle.net/ywSvr/454/

<table>
    <tr>
    <td><div style="display: inline-block; width: 150px;"></div></td>
    </tr>
</table>

<table>
    <col>
    <tr>
    <td>sadfsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
    </tr>
</table>

css:

td {
    border: 1px solid black;
}
col {
    width: 150px;
}

How can i solve this issue?

Upvotes: 1

Views: 735

Answers (1)

RepeatQuotations
RepeatQuotations

Reputation: 724

You can use css property word-wrap:break-word; to break the word as long as your table element has been given a size.

http://jsfiddle.net/sLnrsesh/

Upvotes: 2

Related Questions