Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you make a gradient background without images?

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 http://shup.com/Shup/367066/110519102044-My-Desktop.png

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

like image 293
Jitendra Vyas Avatar asked Jun 19 '10 04:06

Jitendra Vyas


People also ask

Can background color be a gradient?

Just as you can declare the background of an element to be a solid color in CSS, you can also declare that background to be a gradient.

How do I create a gradient background in Canva?

On the left side menu of your Canva window, go to elements and type @contributordanny — yes, exactly like this with the @ and all. That's how you find the creator that uploaded all the gradient elements that are actually customizable with your own colors. Click the gradient element to add it to your design.

How do you make a transparent gradient in CSS?

Linear Gradient - Transparency To add transparency, we use the rgba() function to define the color stops. The last parameter in the rgba() function can be a value from 0 to 1, and it defines the transparency of the color: 0 indicates full transparency, 1 indicates full color (no transparency).


2 Answers

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)";
}
like image 168
Aaron Harun Avatar answered Sep 22 '22 11:09

Aaron Harun


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.

like image 27
desau Avatar answered Sep 24 '22 11:09

desau