由于使用css控制文字只显示多行,超出部分显示省略号,存在一定的兼容性问题,所以总结了一下网上一些大咖使用js实现控制行数的解决方案. 第一步:依次引入jquery.js+jquery.ellipsis.js+jquery.ellipsis.unobtrusive.js. (1)jquery.js源代码下载  http://jquery.com/ (2)jquery.ellipsis.js   源代码 可以通过该部分修改默认的行数,修改row的值即可. (function($) { $.fn.e…
1. 强制一行的情况很简单 overflow:hidden; //超出的隐藏 text-overflow:ellipsis; //省略号 white-space:nowrap; //强制一行显示 2. 如果要强制两行的话,得用到css3的知识 overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; //以此类推,3行4行直接该数…
碰到一些介绍时候需要一行显示,然后超出部分用...替代 white-space: nowrap;不换行显示text-overflow: ellipsis;以...显示overflow: hidden;超出部分隐藏word-wrap: break-word;碰到长单词或者url地址换到下一行…
     <p style="width: 120px; height: 50px; border: 1px solid blue; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">        就是比如有一行文字,很长,表格内一行显示不下.    </p> 现在解释一下为什么要这样做: 1.text-overflow: ellipsis;  这里的重点样式是  text-over…
<p style="width: 300px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"> 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! 省略我吧! </p> 1.text-overflow: ellipsis;  这里的重点样式是  text-overflow: ellipsis; 不过话说te…
当文本框中文字内容过长时,需要调整显示的样式 如上图所示的样式 对应的代码为: <div id="showInfomation" style="visibility: hidden"></div> <tr onmouseover="this.style.backgroundColor = 'white'" onmouseout="this.style.backgroundColor = '#F5FAFE';…
; -webkit-box-orient: vertical;line-height: 26px } <td rowspan="2" colspan="2" ><div class="td_div" ><p>Firefox with a new engine, whether you start 10 or 1000 tabs, gets faster when switchiwhether you start…
<script language="JavaScript"> window.onload = function() { var Table=document.getElementById("table1"); var s = Table.rows.length; for (var i=1;i<s;i++) Table.rows[i].bgColor=i%2?"":"#e3e3e3"; } </scrip…
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <pre id="aa"></pre> <div style="display:none" id=&quo…
//滚动条在内容更新时自动滚到底部var message = document.getElementById('message');message.scrollTop = message.scrollHeight;…