如何在textarea中的文本长度太长时显示点

时间:2017-02-02 07:51:32

标签: html css ionic-framework

我正在编写一个代码,我需要显示点(...)如果textarea中的文本太长,任何人都可以让我知道如何实现它。

3 个答案:

答案 0 :(得分:0)

在你的css文件中,添加

.textarea_class{
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

答案 1 :(得分:0)

您可以将css添加为

.design{
  overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

答案 2 :(得分:0)

<textarea> text-ellipsis无效。我尝试使用<p>并且它可以正常工作

.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
<p class="truncate">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>

<textarea class="truncate">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</textarea>