- @estellevw
- @standardista
- http://www.standardista.com
Really old Webkit Syntax (i.e. Older Android, iPhone devices)
-webkit-gradient(linear, startX startY, endX endY, color-stop, color-stop);
Color Stop
color-stop(0-1, color)
Example
background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(0.5, rgba(255, 255, 255, 0.25)), color-stop(0.5, rgba(255, 255, 255, 0.5)), color-stop(1, rgba(255, 255, 255, 0))); background-color: palegoldenrod;
-prefix-gradient(<angle>|<term>, <colorstop>, <colorstop>)
Color Stop
color length
Example
background-image: -prefix-linear-gradient(270deg, indianred 0%, palegoldenrod 100%);
/* Old Syntax */ background-image: gradient(-prefix-linear, 0 0, 0 100%, indianred, palegoldenrod); /* prefixed syntax // all the same */ background-image: -prefix-linear-gradient(indianred, palegoldenrod); background-image: -prefix-linear-gradient(top, indianred, palegoldenrod); background-image: -prefix-linear-gradient(270deg, indianred, palegoldenrod); background-image: -prefix-linear-gradient(top, indianred 0%, palegoldenrod 100%); background-image: -prefix-linear-gradient(270deg, indianred 0%, palegoldenrod 100%);
linear-gradient(<angle>| to <term>, <colorstop>, <colorstop>)
Key differences:
/* Previous Syntax */ background-image: gradient(linear, 0 0, 0 100%, indianred, palegoldenrod); /* Supported prefixed syntax // all the same */ background-image: linear-gradient(top, indianred 0%, palegoldenrod 100%); /* W3C Standards Syntax (-moz- in FF10, no prefix in FF16 / Opera 12.1) */ background-image: linear-gradient(to bottom, indianred 0%, palegoldenrod 100%);/* SLIDE Works everywhere except old mobile */
background: linear-gradient(indianred, palegoldenrod);
<angle> top bottom left right top left top right bottom left bottom right
background: linear-gradient(indianred, palegoldenrod);Try it
background: linear-gradient(indianred, palegoldenrod);Try it
In the next slides,
edit the code to
make really ugly rainbows
background-image:
linear-gradient(to bottom,
red 0%,
orange 20%,
yellow 40%,
green 60%,
blue 80%,
purple 100%
);
.rainbow {
background-image:
linear-gradient(to bottom,
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,
palegoldenrod 40%,
#BDD9D5 60%
);
}
background-color: palegoldenrod; 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: palegoldenrod; background-image: linear-gradient( rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 50%), linear-gradient(to right, 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: palegoldenrod background-size: 100px 100px; }
.thisSlide {
background-image:
radial-gradient(
palegoldenrod,
#BDD9D5);
}
.thisSlide {
background-image:
radial-gradient(at 25% 35%,
palegoldenrod,
#BDD9D5);
}
.thisSlide {
background-image:
radial-gradient(at 25% 35%,
palegoldenrod 20%,
#BDD9D5 20%);
}
.thisSlide {
background-image:
radial-gradient(circle at 75% 75%,
palegoldenrod 20%,
#BDD9D5 20%);
}
.thisSlide {
background-image:
radial-gradient(farthest-corner at 40px 50px, palegoldenrod 298px,
#BDD9D5 300px);
}
.thisSlide { background-image: radial-gradient( circle, #BDD9D5 50%, palegoldenrod 50%); background-size: 100px 100px; background-repeat: repeat; background-color: red; }
CSS Deep Dive