0

I have a div with stuff in it on a page with a background gradient.
Now towards the right, I would like to fade that div out to the background:

enter image description here

I have tried using background gradients, but those are behind the text. Basically what I would need was a foreground property which I could fill with another gradient.

How can I achieve this without needing to use canvas and JavaScript?

Golo Roden
  • 127,345
  • 89
  • 282
  • 404
Cobra_Fast
  • 14,992
  • 8
  • 56
  • 101

2 Answers2

1

I suggest creating a transparent .png image and applying it as a background on top of the div with text by creating a class with absolute positioning.

.transparent {background: url("xxxxxx.png") repeat-y 0 0 transparent; position:absolute; top:0; right:0; z-index:1;}

Hope this helps.

Nitesh
  • 15,091
  • 4
  • 44
  • 55
0

A transparent (rgba) gradient in a separate DIV positioned absolutely on top of the original div should do the trick.

Caveat: Absolute positioning may not be feasible, depeding on your layout.

Jens Neubauer
  • 1,105
  • 1
  • 13
  • 24