![Alt](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9hdmF0YXIuY3Nkbi5uZXQvNy83L0IvMV9yYWxmX2h4MTYzY29tLmpwZw)
1.先上效果图
![效果图1](https://img-blog.csdnimg.cn/20200120105851576.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTMzNTcxNjU=,size_16,color_FFFFFF,t_70)
2.源码
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("th").mouseover(function(){
var cnt = $(this).text();
$(this).attr("title",cnt);
});
$("td").mouseover(function(){
var cnt = $(this).text();
$(this).attr("title",cnt);
});
});
</script>
<style type="text/css">
table{
width:400px;
height:200px;
border-color:red;
table-layout:fixed;
}
table th{
width:200px;
height:100px;
border-color:red;
white-space: nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
table td{
width:200px;
height:50px;
border-color:red;
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
</style>
</head>
<body>
<div>
<table border="1" cellspacing="0" cellpadding="0" >
<tr><th>宽200,高100</th><th>整个表格 都有边框,直接在table上设置border="1" cellspacing="0" cellpadding="0".看看这里是不是用省略号代替了呢?????看看这里是不是用省略号代替了呢?????看看这里是不是用省略号代替了呢?????</th></tr>
<tr><td>宽200,高50</td><td>222</td></tr>
<tr><td>111</td><td>使用省略号代替省略的内容,鼠标悬置会用title的形式展示出来;使用省略号代替省略的内容,鼠标悬置会用title的形式展示出来;</td></tr>
</table>
</div>
</body>
</html>