📜  css max lines - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:29.026000             🧑  作者: Mango

代码示例4
.className{
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

   line-height: 16px; /* Height taken by one line */
   max-height: 32px; /* (line-height * numberOfLineYouWant) In this case we want 2 lines so we will multiply lineHeight by 2 so 16 * 2 = 32 => 32px */
                        /* Remember if you have more height then it'll render new line so match height of container with => lineHeight * numberOfLines */
}