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
  • 140,679
  • 96
  • 298
  • 425
Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102

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,425
  • 4
  • 48
  • 60
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,090
  • 1
  • 13
  • 24