Bootstrap 4:在卡片文本中隐藏溢出 [英] Bootstrap 4: hide overflow in card-text

查看:653
本文介绍了Bootstrap 4:在卡片文本中隐藏溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张bootstrap 4卡,我想在其中隐藏字幕的上溢(并显示"...").我怎样才能做到这一点?如果可能的话,使用纯自举程序代码...

I have a bootstrap 4 card in which I want to hide the overflow of the subtitle (and show "..."). How can I achieve this? If possible with pure bootstrap code...

<div class="card-block p-1">
    <p class="card-title">Test object</p>
    <p class="card-subtitle text-muted">Added by Someone with a long name</p>
    <p class="card-text mx-auto text-center"><span class="badge badge-pill badge-danger">€ 800</span></p>
</div>

推荐答案

只需使用text-truncate util类..

Just use the text-truncate util class..

     <div class="card">
            <div class="card-block p-1">
                    <p class="card-title">Test object</p>
                    <p class="card-subtitle text-muted text-truncate">Added by Someone with a long name</p>
                    <p class="card-text mx-auto text-center"><span class="badge badge-pill badge-danger">€ 800</span></p>
            </div>
     </div>

https://www.codeply.com/go/bZufg6X1So

这篇关于Bootstrap 4:在卡片文本中隐藏溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆