【CSS】How to implement animation to display text line by line using transition | Demo page

※Please check using Developer tools

Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text Dummy Text

Sponsored links

CSS

.block {
  width: 300px;
  margin: 50px auto 0;
  line-height: 2.5;
}

.block span {
  position: relative;
  display: block;
  border-bottom: 1px dashed #000;
}

.block span:after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background-color: #fff;
}

.block span:nth-child(1):after {
  transition: height 0.6s ease 1.1s;
}

.block span:nth-child(2):after {
  transition: height 0.6s ease 1.45s;
}

.block span:nth-child(3):after {
  transition: height 0.6s ease 1.8s;
}

.block span:nth-child(4):after {
  transition: height 0.6s ease 2.15s;
}

.block span:nth-child(5):after {
  transition: height 0.6s ease 2.5s;
}

.block.active span:after {
  height: 0;
}

JavaScript

$(window).on('load', function(){
  $(".block").addClass("active");
});