问题描述:在开发过程中,td标签中的有一个cell格中的内容过长,导致td标签高度增加,从而导致整个页面内容的不协调:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfYAAAEdCAIAAABxCtKqAAAObElEQVR4nO3dwUEbSRQEUOIiIOIhGpIhGPZgLwIbsNQ9/Wt+672T13jFqEoqDSOwH94AOnh4eEgfQj8iA3ow8QN+R/YAwH7eJz73MgNn5wlyBlq4lYmHq3iCnIEWbmXi60i4NfWdgRZuZeLrSLg19Z2BFm5l4utIuDX1nYEWbmXi60i4NfWdgRZuZeLrSLg19Z2BFm5l4utIuDX1nYEWbmXi60i4NfWdgRZuZeLrSLg19Z2BFm5l4utIuDX1nYEWbmXi60i4NfWdgRZuZeLrSLg19Z2BFm5l4utIuDX1xalggImvI+HW1BenggEmvo6EW1NfnAoGmPg6Em5NfXEqGGDi60i4NfXFqWCAia8j4dbUF6eCASa+joRbU1+cCgaY+DoSbk19cSoYYOLrSLg19cWpYICJryPh1tQXp4IBJr6OhFtTX5wKBpj4OhJuTX1xKhhg4utIuDX1xalggImvI+HW1BenggEmvo6EW1NfnAoGmPg6Em5NfXEqGGDi60i4NfXFqWCAia8j4dbUF6eCASa+joRbU1+cCgaY+DoSbk19cSoYYOKLiLc7DcapYICJLyLe7jQYp4IBJr6IeLvTYJwKBpj4IuLtToNxKhhg4ouItzsNxqlggIkvIt7uNBinggEmvoh4u9NgnAoGmPgi4u1Og3EqGGDii4i3Ow3GqWCAiS8i3u40GKeCASa+iHi702CW/MeY+CLi7U6DWfIfY+KLiLc7DWbJf4yJLyLe7jSYJf8xJr6IeLvTYFaL/B/O6f3gsunsTbzd3XOD4YXqI13UFy6Hdc7j24Z4Tyg7B42ki3p78wwadelPgktVxhtdg05uTXVRX1xD/mMuD/TzJxhdg07SRe1JsFnyH3NZhI8JRgfqW6GIjtH9+NFglvzHXKZTgkuJtzsNZsl/jIkvIt7uNJgl/zEmvoh4u9NglvzHmPgi4u1Og1nyH2Pii4i3Ow1myX+M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Yvxz5gdu7fPEf/ivZhP//sr+51Oz2ZWoO3OCif/zBO+6qep61W+nd/Nun/h//unTTfzb26/7OXhMn0fujwftORfw5enh8fn5i6s1Xx5qwy9T7kxs4m/4oveLB0nfq35f3+/R+5I9h7pp4q8Z7/zAr3gN/v8OvVf//82fcwH/PHn6+ShN/Nmd4iz+l5/eqf/98eAZ61HWLchb+RPshon/9kr829vHZk/wsr3o7OHDuwy/L3ic4L5+6eXp4enl5/dcv3+QdbgSdWeyE3/Tau9x1e+HBWn3bt61E3/9m6iTV76PcPjE/671q/ebzjj0fz1qbjmLb3El6s7kJ/7q1d7jS8LVZ/GV51BXTfyt3yQzceH7EIcV9P+J8L+/ND3VA/fbS/Ffn3w1vBJ1Z/ITP3oWb+Lf0udQ/574H6/PfP+/tGhyT198G8PnE4fvfqvPlag7k5/4ibP4jlf9dno374uJ/zjQP+z7hz/2qcfPF2o+3sB3v+ZQX32j2t8vun+fXjW6EnVv8hM/eBbf9arfDu/mfVXbr/D/+rmhP3z42OX4vv0R2I9XMb77NUf64uz87csqn17aXom6Nw////00kW+nGT6L73vVb+938678aYWuP9QA7TSa+E8f6HLVb92/OHHGcygLDyeTn/hbZu9UZ6wAZ5ef+GvO4s94xgpwetmJB6hz9WXTHaXDh2rp5xzV0o+4gAdn8e/Cjz7KpR9xUOTycE8/6ZKyHQAsYuAAtvUfX9AIu2oUysMAAAAASUVORK5CYII=" alt="" />

当td标签高度增加,而表格所在的div高度又固定的时候,会导致最后一行的内容丢失。

解决方法:

给td标签加style属性:

style="white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;overflow:hidden;" width="200"

解释:

使用text-overflow:ellipsis对溢出文本显示省略号有两个好处,一是不用通过程序限定字数;二是有利于SEO。需要使用对对溢出文本显示省略号的通常是文章标题列表,这样处理对搜索引擎更友好,因为标题实际上并未被截字,而是局限于宽度而未被显示而已。
通常的做法是这样的:
1.overflow:hidden;
2.text-overflow:ellipsis;
3.-o-text-overflow:ellipsis;
4.white-space:nowrap;
其中,overflow: hidden和white-space: nowrap都是必须的否则不会显示省略号;-o-text-overflow: ellipsis针对Opera;而宽度的设定主要是针对IE6;

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWQAAABJCAIAAACFPMsrAAAElElEQVR4nO3bu7mjMBCGYTVDTB/KN6QHZdvCUgJdUAQl0IpjbyBAtxEejq8Hf2/Ac1Y2MGDze5C95goACubdBQD4HQgLACqEBQAVwgKACmEBQIWwAKCyhcXct6bt5+Wvim68Xq9jZ5ZnBn6dbnxx9QBeZg2LsYviIIzkoXC9Xud57Nv8IcICOLvoNmTuW9N141htLaIsmPvWmLbraj2IEDIAfrXanEXaV0SNw9y3QgtBZwGc3RIWay+xxkN28cdhMfedKYKBsADOLnQWay+xzl7s3V4Uc5yEBXB2ZVioV9351oRZC+B0xLCoNRdb5zB2xT0K6QCcm3AbMo5lk5HeZvgwSYIl/IPQAE4pD4uua9u+3w8LoQcJX5TQZADnlIWFv9B3b0Pm9SdZYc7Ch0iyFnOdwMkIP/eW5jrzH1pIcxvxTUrXjaQFcCr8RzIAKoQFABXCAoAKYQFAhbAAoEJYAFAhLACoEBYAVAgLACqEBQAVwgKACmEBQIWwAKCyhMXff38ulwtLlixZlsskLC4AUCF0FgBQorMAoEJnAUCFzgKACp0FABU6CwAqdBYAVOgsAKjQWQBQobMAoEJnAUDlbZ3F5Bpj7FB5dLDGNG566T4/yOQaY4xY62DD4GeeJbF45RG9/TU6WvxXeWdnkb5LMpOzD78Mbu3zw4i15pfWp54lRfG1wfe/Rvriv8qhzsIn7PZZNtgQt/7v+NHtyfHTQkobO9wOi3Wr6crFNredx5+zZUV+1A6hivRQbrwXBmtMY21TbFRz7JNrjGmaZjnw6MlynVGte4OvPUvyOflx8bVBae/7xa+DvtUawlusVveDik9eyPM72Flkn2TLPyfXxJddOKf+EvFPsW6KH73VboZV0+1L2wwPRn8Pw1CMhVd8cMlLrAkLv2v/pMk14TiOHftgTeOmcCblOuNaL/XB156l0l3F1wbL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