【问题标题】:Overflow:hidden dots at the end in 2 line paragraphs [duplicate]溢出:两行段落末尾的隐藏点[重复]
【发布时间】:2018-09-03 15:53:54
【问题描述】:

此代码显示一行代码,然后给出三个点。 示例:

The Alsos Mission was an Allied unit formed to ...

我想要两三行,然后是三个点

示例:

  The Alsos Mission was an Allied unit formed to 
  investigate Axis scientific developments ...

div{
  width : 500px;
  overflow:hidden;
  display:inline-block;
  text-overflow: ellipsis;
  white-space: nowrap;
}
<div>
    The Alsos Mission was an Allied unit formed to investigate Axis scientific developments, especially nuclear, chemical and biological weapons, as part of the Manhattan Project during World War II. Colonel Boris Pash, a former Manhattan P
</div>

【问题讨论】:

    标签: html css


    【解决方案1】:

    也许它可以工作!

    div { max-width: 75ch; //characters }

    div:after { content: "..." }

    【讨论】:

    • max-width 对容器应用约束,而不是对其中的文本。因此这是行不通的。请考虑在发布之前尝试您的答案。
    猜你喜欢
    • 1970-01-01
    • 2023-03-23
    • 2020-10-31
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 2019-01-23
    • 2017-02-24
    • 2014-05-01
    相关资源
    最近更新 更多