Top → Bottom:
- /* fallback */
- background-color: #1a82f7;
- background-repeat: repeat-x;
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#2F2727));
- /* Safari 5.1, Chrome 10+ */
- background: -webkit-linear-gradient(top, #2F2727, #1a82f7);
- /* Firefox 3.6+ */
- background: -moz-linear-gradient(top, #2F2727, #1a82f7);
- /* IE 10 */
- background: -ms-linear-gradient(top, #2F2727, #1a82f7);
- /* Opera 11.10+ */
- background: -o-linear-gradient(top, #2F2727, #1a82f7);
Here is the result:
Left → Right
- /* fallback */
- background-color: #1a82f7;
- background-repeat: repeat-y;
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(linear, left top, right top, from(#1a82f7), to(#2F2727));
- /* Safari 5.1, Chrome 10+ */
- background: -webkit-linear-gradient(left, #2F2727, #1a82f7);
- /* Firefox 3.6+ */
- background: -moz-linear-gradient(left, #2F2727, #1a82f7);
- /* IE 10 */
- background: -ms-linear-gradient(left, #2F2727, #1a82f7);
- /* Opera 11.10+ */
- background: -o-linear-gradient(left, #2F2727, #1a82f7);
Here is the result:
With Even Stops:
- /* fallback DIY*/
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.25, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.75, #1a82f7), to(#2F2727));
- /* Safari 5.1+, Chrome 10+ */
- background: -webkit-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
- /* Firefox 3.6+ */
- background: -moz-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
- /* IE 10 */
- background: -ms-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
- /* Opera 11.10+ */
- background: -o-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
With Specified Arbitrary Stops
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.05, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.95, #1a82f7), to(#2F2727));
- /* Safari 5.1+, Chrome 10+ */
- background: -webkit-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
- /* Firefox 3.6+ */
- background: -moz-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
- /* IE 10 */
- background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
- /* Opera 11.10+ */
- background: -o-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
Radial Gradient
Centered and Full Size
- /* fallback */
- background-color: #2F2727;
- background-position: center center;
- background-repeat: no-repeat;
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(radial, center center, 0, center center, 460, from(#1a82f7), to(#2F2727));
- /* Safari 5.1+, Chrome 10+ */
- background: -webkit-radial-gradient(circle, #1a82f7, #2F2727);
- /* Firefox 3.6+ */
- background: -moz-radial-gradient(circle, #1a82f7, #2F2727);
- /* IE 10 */
- background: -ms-radial-gradient(circle, #1a82f7, #2F2727);
- /* Opera cannot do radial gradients yet */
Positioned and Sized
Note: Not Consistent Among Browsers
- /* fallback */
- background-color: #2F2727;
- background-position: 80% 20%;
- background-repeat: no-repeat;
- /* Safari 4-5, Chrome 1-9 */
- background: -webkit-gradient(radial, 80% 20%, 0, 80% 40%, 100, from(#1a82f7), to(#2F2727));
- /* Safari 5.1+, Chrome 10+ */
- background: -webkit-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727);
- /* Firefox 3.6+ */
- background: -moz-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727);
- /* IE 10 */
- background: -ms-radial-gradient(80% 20%, closest-corner, #1a82f7, #2F2727);
- /* Opera cannot do radial gradients yet */
Shape keywords: circle, ellipse Size keywords: closest-side, closest-corner, farthest-side, farthest-corner, contain, cover
No comments:
Post a Comment