css overflow - only 1 line of text

后端 未结 8 1649
别跟我提以往
别跟我提以往 2021-01-30 04:59

I have div with the following css style:

width:335px; float:left; overflow:hidden; padding-left:5px;

When I insert, into that

相关标签:
8条回答
  • 2021-01-30 05:32

    I was able to achieve this by using the webkit-line-clamp and the following css:

    div {
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    
    0 讨论(0)
  • 2021-01-30 05:34

    if addition please, if you have a long text please you can use this css code bellow;

    text-overflow: ellipsis;
    overflow: visible;
    white-space: nowrap;
    

    make the whole line text visible.

    0 讨论(0)
提交回复
热议问题