views:

310

answers:

3

Like this. in general i will make 1 px wide image of this then will repeat-x.

but is it possible to make same type of background with CSS3 , if yes then tell me how tp make same of this.

alt text

with all browser compatibility IE 8, 7, 6 , FF , Chrome, Safari, iphone.

A: 

I think IE 6 and 7 may not support CSS3 gradient. Even though, you can get the CSS code from this site http://gradients.glrzad.com/

ZEAXIF
+1  A: 

Try some of the CSS gradient generators that you can find with a Google search, such as: http://gradients.glrzad.com/

or

http://www.designdetector.com/demos/css-gradients-demo-1.php

Also, take a look at Webkit's gradient tutorial: http://webkit.org/blog/175/introducing-css-gradients/

And Firefox: http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/

Now - that in mind: This is new stuff -- CSS3, which isn't finalized yet. Browser support for CSS3 stuff is very cutting edge. You're not going to get cross browser support for the browsers you've listed. Latest Webkit (Safari, Google Chrome) and Firefox are your best bets. IE supports filters. Opera doesn't support any kind of gradients though.

desau
ok can we give support in IE too using any Javascript
metal-gear-solid
@metal-gear-solid - Yes, but you will have to have a backup gradient image for IE6 and maybe 7, and load those images if CSS doesnt work.
digitalFresh
IE does gradients, they just use "filter."
Aaron Harun
@Aaron Harun - Does IE filter works if javascript is disabled
metal-gear-solid
@Metal, they should. They are pure CSS. Weird CSS, but still CSS.http://msdn.microsoft.com/en-us/library/ms532847%28VS.85%29.aspx
Aaron Harun
+3  A: 

Pretty much all of the browsers support gradients. Here's the CSS you need:

.gradient{
    /* For any browser that can't create a gradient  */
    background-color: #EFEFEF;
    /*//mozilla*/
    background: -moz-linear-gradient(top, #efefef, #FFF);
    /* Chrome/Safari     */
    background: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#FFF));
    /*IE 6/7 */ filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#EFEFEF',EndColorStr='#FFF');
    /*IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#FFF)";
}
Aaron Harun
I couldn't get it to work in FF 3.6.3, Opera 10.53 or IE 8.
Gert G
Check your colors. This is a very delicate one from light grey to white. And Opera doesn't believe in gradients at all.
Aaron Harun
ok but why it's not working http://jsbin.com/iquje4/2 please can you edit this to make same like gradient image in my question
metal-gear-solid
Yes, it was my crappy monitor... :D +1 for you.
Gert G
@metal just change the colors See http://jsbin.com/iquje4/3
Aaron Harun
@Aaron Harun - nothing showing . i'm on FF 3.5.2
metal-gear-solid