<div class="container">
  <article class="card">
    <h1 class="card-title">What is Lorem Ipsum?</h1>
    <p class="card-description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
  </article>

  <article class="card">
    <h1 class="card-title">Where does it come from and Why do we use it?</h1>
    <p class="card-description">Contrary to popular belief, Lorem Ipsum is not simply random text.</p>
  </article>
</div>
.container
  display grid
  grid-template-columns repeat(auto-fit, minmax(240px, 2fr))
  grid-gap 2rem
  max-width 800px
  margin 20px auto 

.card   
  padding 2rem
  border 1px solid #eee
  font-family serif

.card-title
  font-size 2rem
  margin-bottom 20px
  /* The styles here are meant to truncate titles that are too long. The first line ensures long text doesn't overflow its container. The second one ensures we title gets truncated */
  overflow hidden
  white-space nowrap
  /* Then, we show the three dots if the title is too long to be readable */
  text-overflow ellipsis
  
.card-description
  font-size 1.3em
  line-height 140%
   /* Here's where the line-clamp magic begins. First, we need to hide the content that overflows our desired number of text lines to show */
  overflow hidden
  /* Then, we use the old implementation of Flexbox on the paragraph and set its direction to be row */
  display -webkit-box
  -webkit-box-orient vertical
  /* Finally, we set the desired number of lines we want to show */
  -webkit-line-clamp 3
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.