How can I add a large faded text background via css?

前端 未结 4 1201
情话喂你
情话喂你 2020-12-31 17:07

I\'m looking to create a Zune/Microsoft-style oversized title in CSS so that a div has a semi-transparent text behind it.

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 17:58

    Here's my solution. Preview in jsfiddle

    .about_box {
      z-index: 5;
      width: 728px;
      height: 400px;
      position: relative;
      background: #0099ae;
      overflow: hidden;
    }
    
    #about_small {
      z-index: 7;
      position: relative;
      top: 0;
      left: 0;
      color: #f7f7f7;
      padding: 20px;
    }
    
    #about_big {
      z-index: 6;
      font-family: Arial;
      font-size: 120px;
      color: rgba(255, 255, 255, 0.5);
      overflow: hidden;
      padding: 0;
      margin: 0;
      bottom: 0;
      right: 0;
      position: absolute;
    }
    "The quick brown fox jumps over the lazy dog", "The quick brown fox jumps over the lazy dog", "The quick brown fox jumps over the lazy dog", "The quick brown fox jumps over the lazy dog", "The quick brown fox jumps over the lazy dog"
    text

    You might want to experiment with line-height or make bottom negative in #about_big to get the background text right at the bottom.

提交回复
热议问题