0

I have a text heading which is white in color. I want to put an image instead of white color to the text. The Text is big enough to show the image which will be filled in.

image

This is what I basically want.. There's completely different background image behind the text and I want to fill in another image on the text.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
shashankj
  • 37
  • 1
  • 11

2 Answers2

1

You need background-clip to mask up the text. Here's the solution:

<h1>Shashank Jaiswal</h1>
h1 {
    font-family: Arial;
    font-size: 5em;
    text-align: center;

    background-image: url(http://tn.clashot.com/thumbs/3391302/58941884/thumb_w800.jpg);

    -webkit-background-clip: text;
    background-clip: text;

    color: rgba(0,0,0,0);
}

DEMO : http://jsfiddle.net/gnoyubwc/

Wilf
  • 2,297
  • 5
  • 38
  • 82
  • Thanks. It's working for chrome. I tried -moz-background-clip:text; but didn't work in Firefox... I have got some ideas... trying now. – shashankj Mar 31 '15 at 04:20
  • refer to this link http://stackoverflow.com/questions/9362639/moz-background-cliptext-does-not-work-in-firefox - sorry about that :( – Wilf Mar 31 '15 at 14:49
-1

You can use photoshop for that and create a clipping mask. You'll get exactly what you wanted!

Arvind Lakhani
  • 21
  • 1
  • 1
  • 6