views:

162

answers:

3

Hi I want to use gradient color as my page background how do I apply css to get gradient background?

+2  A: 

See:

Cross-Browser CSS Gradient

alt text

Sarfraz
is this working in opera??
kc rajput
A: 

if you want your site to be compatible with all browsers, you can use this :

background-image: url(someurl.gif); background-repeat: repeat-x;

the someurl.gif image should contain the gradient that you want. Have it as a very small piece of image and you can extend it with repeat-x or repeat-y. whichever you prefer.

1s2a3n4j5e6e7v
+2  A: 

css 3 supports gradients but this wont be supported by all browsers (eg IE6). Have a look at this link:

link text

But you could do this, which i think is pretty similar to the previous answer:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
    body {
        padding:0px;
        margin:0px;
    }
    div#bg {
        background: url(http://www.khiba.com/PSP/FALL01/Testgrad.jpg) repeat-x;
        height:600px;
    }
</style>
</head>

<body>
<div id="bg">
</div>
</body>
</html>

Hope that helps!

Ryano