开发者

How do I overflow text to the left in a table?

开发者 https://www.devze.com 2023-01-03 03:43 出处:网络
I have a table with fixed layout. On overflow, the contents of cells should clip from the left instead of the right. That is, if the width of the TD is less than the width of the text, the cell below

I have a table with fixed layout. On overflow, the contents of cells should clip from the left instead of the right. That is, if the width of the TD is less than the width of the text, the cell below should display "67890" instead of "12345".

This needs to work in IE7+ at minimum. Is there a way开发者_运维问答 to do this in css without any JavaScript?

<table style="table-layout:fixed">
  <tr>
    <TD>
      12334567890
   </TD>
 </tr>
</table>


you could use:

direction:rtl;


I haven´t tried it, but you could try text-align:right or wrap the contents in a div and float that right.


You can use the CSS3 property word-wrap: break-word but there's no way to control where it will break the word. It will fit whatever it can on the line and then break it down to the next, it won't keep the lines of equal length.

There is also the <wbr> tag but I've never used or experimented with it, so I can't really tell you how to use it.

0

精彩评论

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