One nice thing is that the syntax for the repeating and non-repeating variants is identical.īecause this specification is still in draft form, we’ve prefixed these gradient functions with -webkit- prefix. The names are pretty self-explanatory, but I’ll say more about repeating gradients later. The new syntax has four gradient functions:
This means that you can use them anywhere you’d use a url(image.png). Here are some simple examples (note that all these examples are resizable, so you can see how resizing the box affects the gradients):īackground-image: -webkit-radial-gradient(circle, white, black) ĭon’t forget that gradients are a type of generated image, not a property.
If you’re not already running one, go and grab a recent nightly build so that you can see the examples in this post. A secondary goal was to specify something where implementations were compatible across browsers.
SAFARI 10.1.2 TOP POSITION CSS CODE
The main goal of the new syntax is simplicity it’s now really easy to code up common gradients, as you’ll see in the examples below. Note that the proposal is still an editor’s draft, which means that it’s still possible, and even likely to change due to user feedback. WebKit and Mozilla have now implemented this proposal so that web authors can experiment with it, and provide feedback to the Working Group. Over the past several months, the CSS Working Group has had extended discussions about making the gradient syntax easier to use, and recently Tab Atkins included a proposal in the latest draft of the Image Values and Replaced Content module. WebKit paved the way for gradients in CSS by adding support for -webkit-gradient back in early 2008, and they’ve become widely used since their introduction.