2

I have some experience making linear gradients in CSS but I would really like to make a radial gradient similar to this image https://i.stack.imgur.com/T85xO.png

Basically a light grey radial positioned at the bottom of the element

BillPull
  • 6,853
  • 15
  • 60
  • 99

3 Answers3

5

You can play with this tool here. Will give you the code as you generate what you want. http://www.westciv.com/tools/radialgradients/index.html

http://gradients.glrzad.com/

robx
  • 3,093
  • 2
  • 26
  • 29
  • +1 for that tool. Though it should be noted that it uses the old syntax for Webkit, which has since be changed to be more in line with the W3C standard recommendation - http://www.webkit.org/blog/1424/css3-gradients/ . It's still a good idea to use the old format to support the past couple of versions, though, but the new format should allow easier conversion from the Gecko code. – Shauna May 23 '11 at 19:49
  • Well, there is new and old now. I been playing with both tools to learn CSS3 gradients, and both works great. – robx May 23 '11 at 19:55
  • 1
    @rotox - Since we're sharing tools, have you seen the one from Colorzilla (http://www.colorzilla.com/gradient-editor/)? It doesn't do radial ones yet, but it's awesome for linear ones, especially for people most familiar with Photoshop. – Shauna May 23 '11 at 20:09
4

Radial gradients are in an implementation mess right now, Safari doesn't support elliptical radial backgrounds (Webkit Nightly does, so support for Safari is coming soon). Chrome has so many versions I'm not sure about it, and IE9 doesn't support them.

So I'd say your best option is faking it through inset box shadows:

.shadow {
  height: 80px;
  box-shadow: inset 0 75px 75px #fff, 
              inset 0 50px 50px #fff,
              inset 0 20px 20px #fff,
              inset 0 5px 5px #fff;

  background: #ccc;
}

http://jsfiddle.net/nmtHf/

methodofaction
  • 70,885
  • 21
  • 151
  • 164
2

24 Ways covered Graidents in Depth this Year with the following article: http://24ways.org/2010/everything-you-wanted-to-know-about-gradients

Towards the bottom they spend a whole section on radial graidents and give you two articles of suggested reading:

MDN
Safari

I would suggest the tool robx posted, but if your like me, you like extra reading on understanding of how things work.

matchew
  • 19,195
  • 5
  • 44
  • 48
  • 1
    I've been through these as well. Good stuff, but if your short on time to learn then code, nothing like tools and generators to teach as you go ;) – robx May 23 '11 at 20:10