0

I have this background:

.background:hover {
    background: #F4F4F4 url(../images/arrow_down_over.gif) no-repeat right;
}

that I would like to change into a gradient like this one :

    .background:hover{
        background: -moz-linear-gradient(top,  #f4f4f4 0%, #eeeeee 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f4f4), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top,  #f4f4f4 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top,  #f4f4f4 0%,#eeeeee 100%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top,  #f4f4f4 0%,#eeeeee 100%); /* IE10+ */
        background: linear-gradient(to bottom,  #f4f4f4 0%,#eeeeee 100%); /* W3C */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee',GradientType=0 );
} /* IE6-9 */

But I would like to keep the arrow image. I can't find a way to do it. I did try something like this:

background: -moz-linear-gradient(top,  #f4f4f4 0%, #eeeeee 100%) url(../images/arrow_down_over.gif) no-repeat right; /* FF3.6+ */

or add this after the gradient properties but without any success.

 background: url(../images/arrow_down_over.gif) no-repeat right;

I can't add another class so I have to deal with this CSS. Any idea how to do it?

Sam
  • 7,252
  • 16
  • 46
  • 65
MagTun
  • 5,619
  • 5
  • 63
  • 104

1 Answers1

2

You may try:

background: url(../images/arrow_down_over.gif), linear-gradient(...);

Multiple backgrounds must be comma-separated rather than space-separated, and they weirdly stack from top to bottom.

Also note that this is not necessarily supported by all browsers.

See http://css-tricks.com/stacking-order-of-multiple-backgrounds/ and https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multiple_backgrounds for details

jcaron
  • 17,302
  • 6
  • 32
  • 46
  • +1, beat me to it. here is a fiddle to demo: http://jsfiddle.net/abhitalks/KeqRB/ – Abhitalks Jun 27 '14 at 10:01
  • Excellent! "You may"... be fantastic! Thanks a lot! – MagTun Jun 27 '14 at 10:11
  • See the duplicate pointed by Suresh, it has a lot more detail: http://stackoverflow.com/questions/2504071/is-it-possible-to-combine-a-background-image-and-css3-gradients – jcaron Jun 27 '14 at 10:14