table中td文字超出长度用省略号隐藏超出内容,鼠标点击内容全部显示
1,设置css样式
<style>
table {
width: 100%;
float: left;
table-layout:fixed;
width:600px;
border:1px solid #ccc;
}
table tr {
line-height: 25px;
border:1px solid #ccc;
}
table td {
border:1px solid #ccc;
text-align:center;
}
.MHover{
border:1px solid #ccc;
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
</style>
2,js设置click和mousemove和mouseout事件
<script>
$(document).ready(function () {
$(".MALL").hide();
$(".MHover").click(function (e) {
$(this).next(".MALL").css({"position":"absolute","top":e.pageY+5,"left":e.pageX+5}).show();
});
$(".MHover").mousemove(function (e) {
$(this).next(".MALL").css({ "color": "fff", "position": "absolute", "opacity": "0.7", "background-color": "666", "top": e.pageY + 5, "left": e.pageX + 5 });
});
$(".MHover").mouseout(function () {
$(this).next(".MALL").hide();
});
});
</script>
3,HTML内容,在td中新增两个div,两个div中的内容必须一致。
<table>
<tr>
<th>姓名</th>
<th>个性签名</th>
<th>性别</th>
</tr>
<tr>
<td>狗子</td>
<td>
<div class="MHover">嘻嘻嘻嘻嘻哈哈12345上山打老虎嘻嘻嘻嘻嘻哈哈</div>
<div class="MALL">嘻嘻嘻嘻嘻哈哈12345上山打老虎嘻嘻嘻嘻嘻哈哈</div>
</td>
<td>男</td>
</tr>
</table>
table中td文字超出长度用省略号隐藏超出内容,鼠标点击内容全部显示的更多相关文章
- CSS3让一段文字多余的用省略号表示,当鼠标移动上去的时候显示全部文字
<style type="text/css"> div { width:100px; overflow:hidden; white-space:nowrap; text ...
- 如何让table中td宽度固定
table中td会随着里面的内容伸缩,设置其width样式并没有效果.这个时候需要下面的CSS可以实现. 首先是设置table .table {table-layout:fixed;} 其次是td . ...
- 如何让table中td与四周有间距
如何让table中td与四周有间距 方法一 在td下再添加一个会计元素 <tr> <td>第2节</td> <td>语文</td> < ...
- table中td内容过长 省略号显示
首先设置 css样式: table { table-layout: fixed;} HTML中的table代码: <tr> <th class="col-md-1" ...
- text-overflow使用文字超多div的宽度或超过在table中<td>
关键字:text-overflow:ellipsis 语法:text-overflow:clip | ellipsis 取值 clip:默认值.不显示省略标记(...),而是简单的裁切. ellips ...
- css实现table中td单元格鼠标悬浮时显示更多内容
table中,td单元格无法显示下全部内容,需要在鼠标hover时显示全部内容. 正常显示样式: 鼠标hover时: html: <td>displayAddress<span cl ...
- 关于Jquery获取Table中td内的内容
$(this).children().eq(1).text()获取的是显示的值$(this).children().eq(1).html()获取的是<td></td>之间的所有 ...
- 让table中td的内容靠上对齐
valign=“top”; <td valign="top"></td> 点此查看详细table的td的valign属性
- 表格中td限宽溢出以省略号代替
table.ms-listviewtable { table-layout:fixed; width: 100%; } table.ms-listviewtable td[role="gri ...
随机推荐
- 【MongoDB详细使用教程】三、高级查询
目录 1.使用比较运算符查询 2.使用关键字查询 2.1.in/not in 关键字 2.2.size 关键字 2.3.exists 关键字 2.4.or 关键字 3.模糊查询 4.查询结果排序 5. ...
- Linux rpm包管理工具
1.什么是rpm包 是一种编译好的二进制软件包,安装速度快. 2.rpm包命名 el6:软件包用于在Red Hat 6.x, CentOS 6.x, and CloudLinux 6.x进行安装 el ...
- 常用linux系统监视软件
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo ##epel源 yum install -y ...
- 数据库-mysql01 简单介绍以及安装部署
本次mysql数据库安装采用二进制安装(免安装即绿色版),数据库版本是mysql5.7.26 首先下载mysql安装包,然后上传服务器里,最后解压. 卸载centos7自带的数据库软件包: [root ...
- 快速、优雅的前端IDE之H-builder-X
为什么介绍的是HBuidler-X而不是Hbuilder HX是全新的一个软件,它抛弃了eclipse架构,使用C++为基础架构.HX目前还不能完全替代HBuilder.但在markdown记事的 ...
- selenium 简介 及浏览器配置
简介: Selenium是一款基于web应用程序的开源测试工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.Selenium是一个自动化的web应用功能测试工具. Seleniu ...
- LeetCode 654. Maximum Binary Tree最大二叉树 (C++)
题目: Given an integer array with no duplicates. A maximum tree building on this array is defined as f ...
- LeetCode 100. Same Tree相同的树 (C++)
题目: Given two binary trees, write a function to check if they are the same or not. Two binary trees ...
- LG5201 「USACO2019JAN」Shortcut 最短路树
\(\mathrm{Shortcut}\) 问题描述 LG5201 题解 最短路树. 显然奶牛的路径就是从\(1\)走到各个草地,于是从\(1\)跑最短路,构建最短路树. 为了保证字典序,从\(1\) ...
- AutoResetEvent介绍及使用场景
AutoResetEvent 允许线程通过发信号互相通信.通常,此通信涉及线程需要独占访问的资源. 线程通过调用 AutoResetEvent 上的 WaitOne 来等待信号.如果 AutoRese ...