87,910
社区成员
发帖
与我相关
我的任务
分享
<script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<style>
.test {
white-space:nowrap;
width:120px;
overflow:hidden;
border:1px solid #000000;
text-overflow:ellipsis;
}
</style>
<script>
$(function(){
$("#b").click(function(){
$(".test").width( $(".test").width()+10)
})
})
</script>
<table style="table-layout:fixed;width: 90%"><tr>
<td class="test">哇鹅防阿我师父阿萨德佛撒代购是打怪的撒个打算勾搭广东省高大范甘迪飞个大概sfasdgasgasdgagaga </td><td >sdf</td>
</tr></table>
<button id="b">点我加长</button>
另外我的想法是这样的:
js拉长时,
用js设置text-overflow :clip
拉长完毕之后再设置text-overflow:ellipsis
试试。
要是不行就只好