【问题标题】:How to display dots (....) if content exceeds in html [duplicate]如果内容超出html [重复],如何显示点(....)
【发布时间】:2017-10-21 17:42:06
【问题描述】:

我尝试过使用 text-overflow: ellipsis;这种语法,但它不起作用任何人都可以帮助我

HTML

   <div class="product-desc">
         <p>How to show dots if text is exceeds than the limit</p>
    </div>

我用过的样式

.product-desc{
    padding: 0.8em 1.5em;
    background: #337AB7;
    text-align: center;
     text-overflow: ellipsis;
}
.product-desc p{
    font-size: 1.2em;
    color: #fff;
    margin-bottom: 0.5em;
    font-family: 'Carrois Gothic', sans-serif;
}

【问题讨论】:

    标签: html css


    【解决方案1】:

    试试下面的:

    .product-desc p{
        font-size: 1.2em;
        color: #fff;
        margin-bottom: 0.5em;
        font-family: 'Carrois Gothic', sans-serif;
        width:180px;
        white-space: nowrap;
        overflow:hidden !important;
        text-overflow: ellipsis;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-23
      • 2016-06-17
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      • 1970-01-01
      • 2021-04-29
      • 1970-01-01
      相关资源
      最近更新 更多