gpt4 book ai didi

css - 如何使用 Bootstrap Media 对象在第二行制作省略号媒体标题

转载 作者:行者123 更新时间:2023-11-27 23:46:57 29 4
gpt4 key购买 nike

如何使用 Bootstrap Media 对象在第二行制作省略号媒体标题?

下图显示了3行,我怎么能限制它只有2行然后省略号

enter image description here

最佳答案

使用css可能是这样的

.media-body h5 {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}

img {
max-width: 50px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />

<div class="media">
<img class="mr-3" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Blue_copyright.svg/250px-Blue_copyright.svg.png" alt="image">
<div class="media-body">
<h5 class="mt-0"> 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.</h5>
Description does here
</div>
</div>

关于css - 如何使用 Bootstrap Media 对象在第二行制作省略号媒体标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56745677/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com