Hi there, I have a bit of a problem here. I have a div with a background image positioned and I want to add a gradient background to this div
<div id="myDiv">
...
</div>
CSS:
#myDiv{
/*border:1px solid green;*/
/*width:940px;*/
padding:10px 0 0 20px;
height:160px;
background:#fafafa url("image.png") no-repeat 100% 60%;
border:1px solid #d4d1c8;
}
Right, I have generated my background gradient using this very interesting resource http://ie.microsoft.com/testdrive/Graphics/CSSGradientBackgroundMaker/Default.html and come up with the following code to integrate into my css:
/* IE10 Consumer Preview */
background-image: -ms-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Opera */
background-image: -o-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #F3F4F4), color-stop(1, #FFFFFF));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* W3C Markup, IE10 Release Preview */
background-image: linear-gradient(to top, #F3F4F4 0%, #FFFFFF 100%);
After having read a bit on the net, it seems that you can combine background images and background gradients, so I came up with this:
#myDiv{
/*border:1px solid green;*/
/*width:940px;*/
padding:10px 0 0 20px;
height:160px;
/*background: url("image.png") no-repeat 100% 60%;*/
border:1px solid #d4d1c8;
/* IE10 Consumer Preview */
background-image: -ms-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Mozilla Firefox */
background-image: url("image.png"), -moz-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Opera */
background-image:url("image.png"), -o-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* Webkit (Safari/Chrome 10) */
background-image: url("image.png"), -webkit-gradient(linear, left bottom, left top, color-stop(0, #F3F4F4), color-stop(1, #FFFFFF));
/* Webkit (Chrome 11+) */
background-image: url("image.png"), -webkit-linear-gradient(bottom, #F3F4F4 0%, #FFFFFF 100%);
/* W3C Markup, IE10 Release Preview */
background-image: url("image.png"), linear-gradient(to top, #F3F4F4 0%, #FFFFFF 100%);
}
That looks ok except that I am missing the image position and image repeat properties no-repeat 100% 60%
Trouble is that when I add it on, it stops working, so is there any way I can integrate them fine amd make sure that, if the browser doesn't support gradients the image is displayed correctly?
thanks