您好,欢迎访问一九零五行业门户网

使用纯CSS3截取字符串

这次给大家带来使用纯css3截取字符串,的注意事项有哪些,下面就是实战案例,一起来看一下。
代码实例如下:
<!doctype html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.jb51.net/" /><title>css</title><style type="text/css"> #first{  width:120px;  height:30px;  background-color:#f30;  overflow:hidden;  text-overflow:clip;  white-space:nowrap;}#second{  width:120px;  height:30px;  background-color:#f30;  overflow:hidden;  text-overflow:ellipsis;  white-space:nowrap;  margin-top:10px;}</style> </head><body><p id="first">qweqweqweqwe</p> <p id="second">qweqweqweqwe</p> </body></html>
特别注意的是:不能够省略white-space:nowrap和overflow:hidden,否则截取字符串无效。
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
推荐阅读:
小程序开发做出弹出菜单功能(附代码)
webpack升级到4.0版本并且安装webpack-cli
以上就是使用纯css3截取字符串的详细内容。
其它类似信息

推荐信息