Is it possible to fade-out the end of a text line in CSS?

前端 未结 2 1161
悲&欢浪女
悲&欢浪女 2021-01-01 01:32

I\'ve seen various examples of how to fade out a line of text in CSS. However, these all involve a gradient overlay which matches the background colour. Usually this might

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-01 02:09

    Is something like this what you're looking for?

    div {
      background: linear-gradient(to bottom right, red, yellow);
    }
    h2 {
        background-image: linear-gradient(90deg,#000000 0%,rgba(0,0,0,0));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        position:relative;
        display:inline-block;
        font-size: 50px;
    }

    test test test test test

提交回复
热议问题