Show first 3 lines in HTML paragraph

前端 未结 3 1073
南方客
南方客 2021-01-04 23:07

I want to show only the first 3 lines of the paragraph below using HTML formatting. I am searching on W3Schools but it doesn\'t show how to do it.



        
3条回答
  •  执笔经年
    2021-01-04 23:58

    Set the height of the paragraph to three line-heigths. Like -

    p{
      line-height:1.2em;
      height:3.6em;
      overflow:hidden;
    }
    

    Set overflow to hidden to hide overflowing text

提交回复
热议问题