Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-moz-background-clip:text does not work in Firefox

Tags:

html

css

firefox

I'm trying to fill in the content of a text in a h1 tag by an image. Following my understanding ;-), I'm doing the following in the html:

<div class="image_clip">
 <h1>
  MY WONDERFULL TEXT
 </h1>
</div>

And in the css file:

.image_clip{
 background: url(../images/default.png) repeat;
 -moz-background-clip: text;
 -moz-text-fill-color: transparent;
 -webkit-background-clip: text;
 -webkit-text-fill-color: transparent;
}

The fact is that it does not yield the expected result... that is the text with the image in it as color. The image is displayed on the entire background of the div and not only behind the text. The text itself is moreover still in black.

I'm trying that on Firefox. Don't have other browsers.

Did I missed something?

Tks for the help.

like image 775
microcosme Avatar asked Feb 20 '12 14:02

microcosme


People also ask

Why is my Mozilla Firefox not working?

If Firefox previously worked but suddenly doesn't start, it may be due to some corrupt data in your settings. Uninstalling and reinstalling Firefox would not fix this problem because your settings are not removed on uninstall. To test to see if this is the problem, use the Profile Manager to create a new profile.

Why won't Firefox open some websites?

Firefox cannot load certain websites If clearing your cookies and cache did not enable you to load the websites that did not work in Firefox, you should check your computer for malware.

How do I get Firefox to work again?

Check for conflicts with your Internet security software Often you can open the program's settings, remove Firefox from its list of allowed or trusted programs, and it will be re-detected and things should start working again. See Configure firewalls so that Firefox can access the Internet.

How do I fix Firefox not responding?

If Firefox just froze on your PC or Mac, try force-quitting and relaunching it. To shut down the browser on PC, right-click the Start button and choose Task Manager. Then, choose Firefox from the list of open apps and select End task. Relaunch the browser after that.


2 Answers

Whilst -webkit-background-clip:text exists, -moz-background-clip:text does not, so you won’t be able to achieve your clipping effect in Firefox. (Unless there’s another way I can’t think of.)

Neither does -moz-text-fill-color, although you could just use color:transparent, as long as the element doesn’t have anything else (e.g. borders, -wekbit-text-stroke) that you want to be visible.

Your code does work in Chrome and Safari:

  • http://jsfiddle.net/7T8am/2/

However, the <h1>’s text does need to be transparent, so if any other CSS code is setting a colour for the <h1>, you’ll need to override it.

like image 155
Paul D. Waite Avatar answered Oct 05 '22 01:10

Paul D. Waite


Per the standard, the background-clip property (which is implemented without a prefix in Firefox, by the way), doesn't have text value. You're using a proprietary WebKit feature, not a standard CSS property....

like image 22
Boris Zbarsky Avatar answered Oct 05 '22 00:10

Boris Zbarsky