Gradients already seen in this presentation
Really old Webkit
gradient(linear, startX startY, endX endY, color-stop, color-stop);
Current
linear-gradient(<angle>|<term>, <colorstop>, <colorstop>)
Future
linear-gradient(<angle>| to <term>, <colorstop>, <colorstop>)
/* Previous Syntax */ background-image: gradient(linear, 0 0, 0 100%, brown, khaki); /* Current prefixed syntax // all the same */ background-image: linear-gradient(brown, khaki); background-image: linear-gradient(top, brown, khaki); background-image: linear-gradient(270deg, brown, khaki); background-image: linear-gradient(top, brown 0%, khaki 100%); background-image: linear-gradient(270deg, brown 0%, khaki 100%); /* future syntax (-moz- in FF10) */ background-image: -moz-linear-gradient(to bottom, brown, khaki);
background: linear-gradient(brown, khaki);
<angle> top bottom left right top left top right bottom left bottom right
background: linear-gradient(brown, khaki);Try it
background: linear-gradient(brown, khaki);Try it
In the next slides,
edit the code to
make really ugly rainbows
background-image:
linear-gradient(top,
red,
orange,
yellow,
green,
blue,
purple
);
background-image:
linear-gradient(top,
red 0%,
orange 20%,
yellow 40%,
green 60%,
blue 80%,
purple 100%
);
.rainbow {
background-image:
linear-gradient(top,
red 20%,
orange 20%,
orange 40%,
yellow 40%,
yellow 60%,
green 60%,
green 80%,
blue 80%
);
}
.rainbow {
background-image:
repeating-linear-gradient(145deg,
red 0,
red 20px,
orange 20px,
orange 40px,
yellow 40px,
yellow 60px,
green 60px,
green 80px,
blue 80px,
blue 100px,
purple 100px,
purple 120px
);
}
.centeredGradient {
background-image:
linear-gradient(90deg,
#C7573A 40%,
#BDD9D5 60%
);
}
background-color: #C7573A; background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0) 100% ); background-size: 100px 100px; background-repeat: repeat;
background-color: #C7573A; background-image: linear-gradient( rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 50%), linear-gradient(left, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 50%); background-size: 100px 100px, 100px 100px;
.iPhone, .android, .safari5andOlder { background-image: -webkit-gradient(linear, 0 0, 100% 0, color-stop(0.5, rgba(255, 255, 255, 0.25)), color-stop(0.5, rgba(255, 255, 255, 0)), color-stop(1, rgba(255, 255, 255, 0))); background-color: #C7573A background-size: 100px 100px; }
Prefixed -webkit-, -moz-, -ms-, -o-
* legacy syntax, ** future syntax
.thisSlide {
background-image:
radial-gradient(
#C7573A,
#BDD9D5);
}
.thisSlide {
background-image:
radial-gradient(25% 35%,
#C7573A,
#BDD9D5);
}
.thisSlide {
background-image:
radial-gradient(25% 35%,
#C7573A 20%,
#BDD9D5 20%);
}
.thisSlide {
background-image:
radial-gradient(75% 75%, circle,
#C7573A 20%,
#BDD9D5 20%);
}
.thisSlide {
background-image:
radial-gradient(75% 75%,
farthest-corner,
#C7573A,
#BDD9D5);
}
.thisSlide { background-image: radial-gradient( circle, #BDD9D5 50%, #C7573A 50%); background-size: 100px 100px, 100px 100px; background-repeat: repeat; background-color: red; }