开发者

Force word wrap in td tag element [duplicate]

开发者 https://www.devze.com 2023-03-11 20:52 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Word-wrap in a html table
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Word-wrap in a html table

I have a table with two columns and specified a width. But when I put a very long string, it does not wrap. Example,

<table width=100% border=1>
   <tr>
       <td width=50%>  <very long string here> </td>
       <td width=50%> </td>
   </tr>
</table>

The problem here that the first column with extend is I put a very long string.

Is there a CSS way 开发者_如何学Pythonto do this?

Please advise.


Use the CSS attribute table-layout or word-wrap.

Also, refer to the following question: Word-wrap in an HTML table.


What you have works, check here:

http://jsfiddle.net/PmR6F/

The columns are 50%.

If you are using large imagery or a solid line of text with no spaces your td will expand.

in this second example I have joined the text together:

http://jsfiddle.net/PmR6F/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号