Fading out text at bottom of a section with transparent div, but height stays under section after overlaying div

后端 未结 5 1581
情话喂你
情话喂你 2020-12-02 17:22

I\'m trying to get a nice fade-out effect at the bottom of a section of text as a \'read more\' indicator.

I\'ve been following a bit off this and other tutorials,

5条回答
  •  清歌不尽
    2020-12-02 17:38

    Simple add .fade-out onto the element you want to "fade-out":

    .fade-out {
      position: relative;
      max-height: 350px; // change the height
    }
    .fade-out:after {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background-image: linear-gradient( rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 1) 100% );
    }
    

提交回复
热议问题