I don't know if this is possible in css, I am sure that it can be done in js but i don't know how...
I have a div with a background and a text that is in another div with another background. What I would like is the text to be transparent and have the first-background as the text background. I don't know if this is clear so I've created a fiddle for this:
<div id="first-background">
<div id="second-background">
<h1>This text should be transparent and have the first-background as its background and ignore the second background.</h1>
</div>
</div>
http://jsfiddle.net/K2Ytv/
The percentage of opacity is calculated as Opacity% = Opacity * 100 To set the opacity only to the background and not the text inside it. It can be set by using the RGBA color values instead of the opacity property because using the opacity property can make the text inside it fully transparent element.
For having a simple, transparent text on an image, you need to have your image or background image in a <div> element, and the content block in another <div>. Then, use the CSS opacity property to set a transparent image or text. The opacity property is used to adjust the transparency of a text or photo.
input[type=text] { background: transparent; border: none; } background-color:rgba(0,0,0,0);
This technique is called clipping mask.
You can refer to DEMOS AND TUTORIALS ON CLIPPING MASK to achieve what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With