Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3 gradient background

Tags:

css

Is this right to apply gradient background to the body from a light shade of grey to white from bottom to top?

body {
    background: -webkit-gradient(linear, bottom, top, from(#e7e7e7, to(#ffffff));
}
like image 242
Aessandro Avatar asked Jul 30 '12 09:07

Aessandro


2 Answers

DEMO to support all capable browsers

body {
  background-color: #ffffff;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#999999));
  background-image: -webkit-linear-gradient(top, #ffffff, #999999);
  background-image:    -moz-linear-gradient(top, #ffffff, #999999);
  background-image:      -o-linear-gradient(top, #ffffff, #999999);
  background-image:         linear-gradient(to bottom, #ffffff, #999999);
}

CSS3 Please might be useful

like image 190
Zoltan Toth Avatar answered Sep 21 '22 17:09

Zoltan Toth


To Zoltan's solution, you could also add:

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999');

to support older IE browsers.

like image 25
Dave Salomon Avatar answered Sep 20 '22 17:09

Dave Salomon