【发布时间】:2020-02-25 04:40:27
【问题描述】:
我想在超过 2 行的文本末尾添加一个椭圆 (...)。目前我已经尝试了空格 nowrap 但这仅适用于一行。
如何实现 2 线椭圆 (...)?
.details {
display: inline-flex;
/* text-align: center; */
/* display:block; */
/* display:table-cell;
vertical-align:middle; */
/* background-color: grey; */
margin-right: 5px;
/* width: 95%; */
width:340px;
height: 75px;
cursor: pointer;
text-align: left;
}
.portalTitle {
/* margin-top: 25px; */
margin: auto;
margin-left: 10px;
/* margin: auto; */
/* line-height: 70px; */
font: Arial;
font-family: sans-serif;
font-size: 16px;
font-weight:500;
line-height: 1.5em;
max-height: 3.2em;
overflow: hidden;
/* white-space: nowrap; */
text-overflow: ellipsis;
}
.profileImg {
cursor: pointer;
max-width: 45px;
height: 45px;
border-radius: 25px;
/* margin-top: 10px; */
/* margin: auto; */
margin: auto 2px;
object-fit: cover;
}
<div class="details">
<img class="profileImg" src="images/testImg.png" />
<span class="portalTitle"> Shanghai, China night sounds sounds and more more more sounds look at all those sounds!</span>
</div>
</div>
【问题讨论】:
-
这能回答你的问题吗? css ellipsis on second line
-
@ThomasGeek 所以不可能吗?如果有怎么办?
-
这能回答你的问题吗? Limit text length to n lines using CSS
标签: javascript html css ellipse