-
Notifications
You must be signed in to change notification settings - Fork 83
/
part_09_gradients.html
881 lines (785 loc) · 28.1 KB
/
part_09_gradients.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
<!doctype html>
<html>
<head>
<!--[if gte IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<![endif]-->
<meta charset="utf-8" />
<title>Gradients || CSS: From Knowledgable to Ninja</title>
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/screen.css" media="projection, screen"/>
<link rel="stylesheet" href="css/print.css" media="print"/>
<link rel="stylesheet" href="css/religion.css" media="all"/>
<!--<script>
document.location.href = '../gradients/index.html'
</script>-->
<style>
.ex_rgba_stripes{
background:
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% ) 40px 40px #BDD9D5 repeat;
background-size: 40px 40px;
}
.whatisborderimage {
margin: auto;
height: 200px;
width: 200px;
background-image:
linear-gradient(#C7573A 5px, transparent 5px, transparent 145px, #C7573A 145px),
linear-gradient(left, #C7573A 5px, transparent 5px, transparent 145px, #C7573A 145px),
linear-gradient(#BDD9D5, #C7573A, #BDD9D5);
background-size: 200px 150px, 150px 200px, 150px 150px;
background-position: center;
background-position: no-repeat;
}
.medexampleshell {width: 600px; margin:auto;}
.medexample { height: 200px; width: 200px; margin: 0 30px 30px; float: left; text-align: center;
padding: 60px 0; box-sizing:border-box; text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;}
.multiplebg {
background-image: linear-gradient(#C7573A, #C7573A), linear-gradient(#BDD9D5,#BDD9D5);
background-size: 180px 180px;
background-repeat: no-repeat;
background-position: 0 0, 20px 20px;
}
.bgimage {
background-image: radial-gradient(50% 50%, circle closest-side, transparent 70%, #C7573A 70%,#C7573A 85%,transparent 85% );
background-size: 190px 190px;
background-repeat: no-repeat;
background-position: 0 0;
}
.linear {
background-image:
linear-gradient(left,
rgba(0,0,0,0.5) 8%,
rgba(0,0,0,0.1) 24%);
}
.linrepeat {
background-image:
repeating-linear-gradient(left,
rgba(0,0,0,0.5) 8%,
rgba(0,0,0,0.1) 24%);
}
.radial {
background-image:
radial-gradient(40px 40px, circle,
rgba(0,0,0,0.9),
rgba(0,0,0,0.1) 8%,
rgba(0,0,0,0.5) 16%);
}
.radrepeat {
background-image:
repeating-radial-gradient(40px 40px, circle,
rgba(0,0,0,0.9),
rgba(0,0,0,0.1) 8%,
rgba(0,0,0,0.5) 16%);
}
.grad {
width: 250px;
height: 180px;
margin: 0 20px 20px 0px;
float: left;
border-radius: 150px;
background-repeat: repeat;
}
.basiclinear {
background: linear-gradient(brown, khaki);
}
.dark header{
background-color: rgba(255,255,255,0.5);
}
.angle {
position: absolute;
padding: 50px 50px 30px 50px;
color: rgba(255,255,255,0.01);
text-shadow: 1px 1px 1px rgba(0,0,0,0.01);
text-align: center;
}
.angle:hover {
text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
color: white;
}
#basiclinear:after,
#slide_basiclinearangles:after,
#slide_anglevkeyterm:after {
content: "";
background-color: black;
top: 49%;
left: 49%;
bottom: 49%;
right: 49%;
position:absolute;
border-radius: 50%;
}
.comparegrad {
height: 300px;
display: inline-block;
width: 300px;
border: 5px solid #BDD9D5;
margin-right: 10px;
}
.comparegradkeyterm {
background: linear-gradient(top left, transparent 49.75%, black 49.75%, black 50%, transparent 50%),-webkit-linear-gradient(bottom left, brown, khaki, brown, khaki, brown, khaki, brown, khaki);
}
.comparegradangle {
background: linear-gradient(-45deg, transparent 49.75%, black 49.75%, black 50%, transparent 50%),-webkit-linear-gradient(45deg, brown, khaki, brown, khaki, brown, khaki, brown, khaki);
}
.rainbow {
background: linear-gradient(top, red, orange, yellow, green, blue, purple);
}
.rainbow2 {
background-image:
linear-gradient(top,
red 20%,
orange 20%,
orange 40%,
yellow 40%,
yellow 60%,
green 60%,
green 80%,
blue 80%
);
}
#rainbow5{
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);
}
#rainbow5b {
background-image: linear-gradient(90deg,
#C7573A 40%,
#BDD9D5 60%);
}
#angledStripes {
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;
}
#tablecloth, #ancientgrad {
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;
background-repeat: repeat;
}
#ancientgrad {
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)));
}
#radial01 {
background-image:
radial-gradient(
#C7573A,
#BDD9D5);
}
#radial02 {
background-image:
radial-gradient(25% 35%,
#C7573A,
#BDD9D5);
}
#radial03 {
background-image:
radial-gradient(25% 35%,
#C7573A 20%,
#BDD9D5 20%);
}
#radial04 {
background-image:
radial-gradient(75% 75%, circle,
#C7573A 20%,
#BDD9D5 20%);
}
#radial05 {
background-image:
radial-gradient(75% 75%, farthest-corner,
#C7573A,
#BDD9D5);
}
#radial06 {
background-image:radial-gradient(
circle,
#BDD9D5 50%,
#C7573A 50%);
background-size: 50px 50px;
background-repeat:repeat;
background-color: red;
}
input[type=range] {width: 360px;}
/* color: #C7573A;
BDD9D5*/
</style>
</head>
<body>
<div id="topinfo">
</div>
<div id="info">
<p>
<span class="key">→</span> and <span class="key">→</span> to change slides.
<span class="key">2</span> for comments. <a href="http://estelle.github.com/CSS-Workshop">estelle.github.com/CSS-Workshop</a>
</p>
</div>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<div class="slide normal">
<header>
<h1 style="font-size:200%;">CSS: from Knowledgable to Ninja</h1>
</header>
<section class="content">
<p> ◈ Estelle Weyl</p>
<p> ◈ <a href="http://www.twitter.com/estellevw">@estellevw</a></p><p> ◈ <a href="http://www.standardista.com">www.standardista.com</a></p>
</section>
</div>
<!-- OUTLINE -->
<div class="slide normal">
<header><h1>Course Outline</h1></header>
<section class="content">
<ol><li><a href="../selectors/">Selectors</a></li>
<li><a href="part_02_specificity.html">Specificity</a></li>
<li><a href="part_03_generated.html">Generated Content</a></li>
<li><a href="part_04_media.html">Media Queries</a></li>
<li><a href="part_04_media.html#slide10">Debugging</a></li>
<li><a href="part_06_colors.html">Colors & Transparency </a></li>
<li><a href="part_07_fonts.html">Fonts / Typography </a></li>
<li><a href="part_08_backgrounds.html">Backgrounds & Borders </a></li>
<li><a href="../gradients/">Gradients</a></li>
<li><a href="part_10_transforms.html">Transforms</a></li>
<li><a href="../animation/">Transitions & Animation</a></li>
<li><a href="part_12_features.html">Other Features</a></li>
</ol>
</section>
</div>
<!-- Title Slide -->
<div class="slide intro">
<header><h1>Part 9: Gradients</h1></header>
</div>
<!-- Why Gradients -->
<div class="slide normal">
<header><h1>Why Gradients</h1></header>
<section class="content">
<p>Gradients already seen in this presentation</p>
<div class="medexampleshell">
<div class="ex_rgba_stripes medexample">Background for Shadow</div>
<div class="whatisborderimage medexample">Border Image explanation</div>
<div class="multiplebg medexample">Multiple Backgrounds</div>
<div class="bgimage medexample">Background Properties</div>
</div>
</section>
</div>
<!-- library examples -->
<div class="slide normal">
<header><h1>Other Gradients</h1></header>
<section class="content">
<div class="greenbean grad"></div>
<div class="metal grad"></div>
<div class="classic grad"></div>
<div class="inverse1 grad"></div>
<div class="bradybunch grad"></div>
<div class="tiltdavid grad"></div>
<div class="retro67 grad"></div>
<div class="blurry grad"></div>
<div class="circlestripes grad"></div>
</section>
</div>
<!-- 4 kind of radients -->
<div class="slide normal">
<header><h1>Gradients</h1></header>
<section class="content">
<ul>
<li>Anywhere an image can be used (theoretically)
<ul><li>background-image, list-style-type, border-image, content, cursor</li></ul>
</li>
<li>4 Gradient Types
<ul class="medexampleshell" id="lgresize">
<li class="medexample linear">linear-gradient();</li>
<li class="medexample radial">radial-gradient();</li>
<li class="medexample linrepeat">repeating-linear-gradient()</li>
<li class="medexample radrepeat">repeating-radial-gradient()</li>
</ul>
</li>
</ul>
</section>
</div>
<!-- W3C syntax -->
<div class="slide normal">
<header><h1>Linear Gradient Syntax</h1></header>
<section class="content">
<p>Really old Webkit</p>
<pre contenteditable>gradient(linear, startX startY, endX endY, color-stop, color-stop);</pre>
<p>Current</p>
<pre contenteditable>linear-gradient(<em><angle></em>|<em><term></em>, <em><colorstop></em>, <em><colorstop></em>)</pre>
<p>Future</p>
<pre contenteditable>linear-gradient(<em><angle></em>| to <em><term></em>, <em><colorstop></em>, <em><colorstop></em>)</pre>
</section>
</div>
<!-- simple syntax -->
<div class="slide dark object basiclinear">
<header><h1>Basic Linear Gradient Syntax</h1></header>
<section class="content" style="margin-top:50px;">
<pre contenteditable><span style="opacity: 0.3;">/* Previous Syntax */</span>
background-image:
gradient(linear, 0 0, 0 100%, brown, khaki);
<span style="opacity: 0.3;">/* Current prefixed syntax // all the same */</span>
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%);
<span style="opacity: 0.3;">/* future syntax (-moz- in FF10) */ </span>
background-image:
-moz-linear-gradient(to bottom, brown, khaki); </pre>
</section>
</div>
<!-- keyterm values -->
<div class="slide dark object basiclinear" id="basiclinear">
<header><h1>Basic Syntax: Linear Gradient</h1></header>
<section class="content" style="margin-top:100px;">
<pre contenteditable>
background: linear-gradient(<span id="basicgradient"></span>brown, khaki);
<select onChange="basicGradientChange();" id="slct_basicgradient" style="float:right">
<option value=""></option>
<option value="top">top</option>
<option value="bottom">bottom</option>
<option valut="left">left</option>
<option value="right">right</option>
<option value="top left">top left</option>
<option value="top right">top right</option>
<option value="bottom left">bottom left</option>
<option value="bottom right">bottom right</option>
</select>
</pre>
<pre style="float: left" contenteditable><angle>
top
bottom
left
right
top left
top right
bottom left
bottom right</pre>
<div class="angle notes" style="top:0; left: 350px">top <br> (270deg)</div>
<div class="angle notes" style="bottom: 0; left: 350px;">bottom<br> (90deg)</div>
<div class="angle notes" style="left: 0; top: 300px;">left <br> (0deg/360deg)</div>
<div class="angle notes" style="right: 0; top: 300px;">right<br> (180deg)</div>
<div class="angle notes" style="top:0; left:0;">top left</div>
<div class="angle notes" style="top:0; right:0;">top right</div>
<div class="angle notes" style="bottom:0; left:0;">bottom left</div>
<div class="angle notes" style="bottom:0; right:0;">bottom right</div>
<script defer="">
function basicGradientChange(event) {
var value = document.getElementById('slct_basicgradient').value, invertvalue;
console.log(value);
switch (value) {
case "top":
case "bottom":
invertvalue = 'left';
break;
case "left":
case "right":
invertvalue = 'top';
break;
case "top left":
case "bottom right":
invertvalue = 'bottom left';
break;
case "bottom left":
case "top right":
invertvalue = 'bottom right';
break;
default: invertvalue = '';
}
document.getElementById('basiclinear').style.background =
'-webkit-linear-gradient(' + invertvalue + ', transparent 49.75%, black 49.75%, black 50%, transparent 50%), -webkit-linear-gradient(' + value + ', brown, khaki)';
if(value) {
document.getElementById('basicgradient').innerHTML = value + ", ";
} else {
document.getElementById('basicgradient').innerHTML = "";
}
}
</script>
</section>
</div>
<!-- angle values -->
<div class="slide dark object basiclinear" id="slide_basiclinearangles">
<header><h1>Linear Gradient Angles</h1></header>
<section class="content" style="margin-top:100px;">
<pre contenteditable>
background: linear-gradient(<span id="basiclinearangles"></span>brown, khaki);
</pre>
<input type="range" min="0" max="360" onChange="angleGradientChange();" id="slct_basiclinearangles" />
<a href="files/91_basic.html" class="objectlink" target="play">Try it</a>
<script defer="">
function angleGradientChange(event) {
var value = document.getElementById('slct_basiclinearangles').value || 270;
var degvalue = value + "deg";
var invertvalue = value - 90;
document.getElementById('slide_basiclinearangles').style.background =
'-webkit-linear-gradient(' + invertvalue + 'deg, transparent 49.75%, black 49.75%, black 50%, transparent 50%),-webkit-linear-gradient(' + degvalue + ', brown, khaki)';
if(value) {
document.getElementById('basiclinearangles').innerHTML = "<b>" + degvalue + "</b>, ";
} else {
document.getElementById('basiclinearangles').innerHTML = "";
}
}
</script>
</section>
</div>
<!-- angels != keyterms -->
<div class="slide dark object basiclinear" id="slide_anglevkeyterm">
<header><h1>Angles ≠ Keyterms</h1></header>
<section class="content" style="margin-top:100px;">
<pre contenteditable>
background: linear-gradient(<span id="anglevkeyterm"></span>brown, khaki);
</pre>
<button onClick="angleNotEqual('45deg')">45deg</button> <button onClick="angleNotEqual('bottom left')">bottom left</button>
<a href="files/91_basic.html" class="objectlink" target="play">Try it</a>
<script defer="">
function angleNotEqual(angle) {
var invertvalue = (angle == '45deg') ? "-45deg" : "top left";
document.getElementById('slide_anglevkeyterm').style.background =
'-webkit-linear-gradient(' + invertvalue + ', transparent 49.75%, black 49.75%, black 50%, transparent 50%),-webkit-linear-gradient(' + angle + ', brown, khaki)';
document.getElementById('anglevkeyterm').innerHTML = "<b>" + angle + "</b>, ";
}
</script>
</section>
</div>
<!-- angels != keyterms 2 -->
<div class="slide normal">
<header><h1>Angles ≠ Keyterms</h1></header>
<section class="content">
<div class="comparegrad comparegradkeyterm" id="comparegrad1"><span class="button">bottom left</span></div>
<div class="comparegrad comparegradangle" id="comparegrad2"><span class="button">45deg</span></div>
<input type="range" onChange="heightChange(this);" min="100" max="450" style="transform: rotate(90deg); position:absolute; right:10px; top: 200px;">
</section>
<script defer>
function heightChange(val){
var height = val.value + 'px';
var divs = document.querySelectorAll('.comparegrad');
for(var i=0, count = divs.length; count > i; i++){
divs[i].style.height = height;
}
}
</script>
</div>
<!-- color me instructions -->
<div class="slide normal">
<header><h1>Edit the backgrounds</h1></header>
<section class="content">
<p style="text-align:center">In the next slides,<br>
edit the code to<br>
make really ugly rainbows</p>
</section>
</div>
<!-- color stops -->
<div class="slide object rainbow" id="rainbow">
<header><h1>Adding Colors</h1></header>
<section class="content" style="margin-top:100px;">
<pre contenteditable> background-image:
<span contenteditable id="colerme1" onKeyUp="changeBackgroundGradient('rainbow','#colerme1')">linear-gradient(top,
red,
orange,
yellow,
green,
blue,
purple
)</span>;
</section>
</div>
<!-- color stops -->
<div class="slide object rainbow" id="rainbow3">
<header><h1>Color Stops</h1></header>
<section class="content" style="margin-top:100px;">
<pre contenteditable id="colorme" onKeyUp="changeBackgroundGradient('rainbow3','#colorme span')"> background-image:
<span>linear-gradient(top,
red 0%,
orange 20%,
yellow 40%,
green 60%,
blue 80%,
purple 100%
)</span>;
</pre> </section>
</div>
<!-- color stops -->
<div class="slide object rainbow2" id="rainbow4">
<header><h1>Hard Color Stops</h1></header>
<section class="content" style="margin-top:100px;">
<pre style="background-color: rgba(255,255,255,0.7)">.rainbow {
background-image:
<span contenteditable id="colorme3" onKeyUp="changeBackgroundGradient('rainbow4','#colorme3')">linear-gradient(top,
red 20%,
orange 20%,
orange 40%,
yellow 40%,
yellow 60%,
green 60%,
green 80%,
blue 80%
)</span>;
}</pre>
</section>
</div>
<!-- color stops -->
<div class="slide object rainbow2" id="rainbow5">
<header><h1>Stripes</h1></header>
<section class="content">
<pre style="background-color: rgba(255,255,255,0.7)">.rainbow {
background-image:
<span contenteditable id="colorme5" onKeyUp="changeBackgroundGradient('rainbow5','#colorme5')">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
)</span>;
}</pre>
</section>
</div>
<!-- color stops Ends of gradient -->
<div class="slide object rainbow2" id="rainbow5b">
<header><h1>End Points</h1></header>
<section class="content">
<pre style="background-color: rgba(255,255,255,0.7)">.centeredGradient {
background-image:
<span contenteditable id="colorme5b" onKeyUp="changeBackgroundGradient('rainbow5b','#colorme5b')">linear-gradient(90deg,
#C7573A 40%,
#BDD9D5 60%
)</span>;
}</pre>
</section>
</div>
<!-- angled stripes -->
<div class="slide object angledStripes" id="angledStripes">
<header><h1>Stripes with background-size</h1></header>
<section class="content">
<pre style="background-color: rgba(255,255,255,0.7)">background-color: <span id="feature01" onKeyUp="changeFeature('backgroundColor', 'feature01', 'angledStripes')" contenteditable>#C7573A</span>;
background-image:
<span contenteditable id="colorme6" onKeyUp="changeBackgroundGradient('angledStripes','#colorme6')">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%
)</span>;
background-size: <span id="feature02" onKeyUp="changeFeature('backgroundSize', 'feature02', 'angledStripes')" contenteditable>100px 100px</span>;
background-repeat: <span id="feature03" onKeyUp="changeFeature('backgroundRepeat', 'feature03', 'angledStripes')" contenteditable>repeat</span>;
</pre>
</section>
</div>
<!-- table cloth -->
<div class="slide object angledStripes" id="tablecloth">
<header><h1>Different effects</h1></header>
<section class="content">
<pre style="background-color: rgba(255,255,255,0.7)">background-color: <span id="feature04" onKeyUp="changeFeature('backgroundColor', 'feature04', 'tablecloth')" contenteditable>#C7573A</span>;
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: <span id="feature05" onKeyUp="changeFeature('backgroundSize', 'feature05', 'tablecloth')" contenteditable>100px 100px, 100px 100px</span>;
</pre>
</section>
</div>
<!-- old webkit syntax -->
<div class="slide object" id="ancientgrad">
<header><h1>Old Webkit</h1></header>
<section class="content">
<pre contenteditable>.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: <span id="feature06" onKeyUp="changeFeature('backgroundColor', 'feature06', 'ancientgrad')" contenteditable>#C7573A</span>
background-size: <span id="feature07" onKeyUp="changeFeature('backgroundSize', 'feature07', 'ancientgrad')" contenteditable>100px 100px</span>;
} </pre>
</section>
</div>
<!-- tips on gradients -->
<div class="slide ">
<header><h1>Tips on Gradient</h1></header>
<section class="content">
<ul>
<li>vendor-prefix ‘linear-gradient’ and ‘radial-gradient’ </li>
<li>keyword ‘transparent’ = rgba(0,0,0,0) so fades to grey</li>
<li>create effects with color stops at same location</li>
<li>create effects by adding multiple gradients, playing with position and size</li>
<li>learn from others: <a href="http://leaverou.me/css3patterns/">Lea Verou's Gradients</a>, <a href="http://www.standardista.com/cssgradients">Estelle Weyl's Gradients</a>, and <a href="http://www.standardista.com/CSS3gradients/flags.html">Estelle's Flags</a></li>
<li>Use tools: <a href="http://westciv.com/tools/gradientsnustyle/">John Allsopp's tool</a>, <a href="http://gradients.glrzad.com/">Damian Galarza's tool</a>, <a href="http://www.colorzilla.com/gradient-editor/">Colorzilla</a></li>
</ul>
<ul class="icons" style="margin:0">
<li class="chrome">Chrome 3* <br/>Chrome 10</li>
<li class="safari">Safari 4* <br/>Safari 5.1</li>
<li class="firefox">Firefox 3.6<br/>Firefox 10**</li>
<li class="opera new">Opera 11.1<br/> </li>
<li class="ie new">Internet Explorer 10</li>
</ul><p style="margin-top: 0">Prefixed -webkit-, -moz-, -ms-, -o-</p>
<p>* legacy syntax, ** future syntax</p>
</section>
</div>
<!-- radial gradients title-->
<div class="slide intro">
<header><h1>Radial Gradients</h1></header>
</div>
<!-- radial gradients -->
<div class="slide object" id="radial01">
<header><h1>Radial Gradients</h1></header>
<section class="content">
<pre contenteditable>.thisSlide {
background-image:
<span contenteditable id="radialfeature01" onKeyUp="changeBackgroundGradient('radial01','#radialfeature01')">radial-gradient(
#C7573A,
#BDD9D5)</span>;
}</pre>
</section>
</div>
<!-- radial gradients -->
<div class="slide object" id="radial02">
<header><h1>Radial Gradients</h1></header>
<section class="content">
<pre contenteditable>.thisSlide {
background-image:
<span contenteditable id="radialfeature02" onKeyUp="changeBackgroundGradient('radial02','#radialfeature02')">radial-gradient(25% 35%,
#C7573A,
#BDD9D5)</span>;
}</pre>
</section>
</div>
<!-- radial gradients -->
<div class="slide object" id="radial03">
<header><h1>Radial Gradients</h1></header>
<section class="content">
<pre contenteditable>.thisSlide {
background-image:
<span contenteditable id="radialfeature03" onKeyUp="changeBackgroundGradient('radial03','#radialfeature03')">radial-gradient(25% 35%,
#C7573A 20%,
#BDD9D5 20%)</span>;
}</pre>
</section>
</div>
<!-- radial shape -->
<div class="slide object" id="radial04">
<header><h1>Shape</h1></header>
<section class="content">
<pre contenteditable>.thisSlide {
background-image:
<span contenteditable id="radialfeature04" onKeyUp="changeBackgroundGradient('radial04','#radialfeature04')">radial-gradient(75% 75%, circle,
#C7573A 20%,
#BDD9D5 20%)</span>;
}</pre>
<ul>
<li>circle</li>
<li class="imp">ellipse</li>
</ul>
</section>
</div>
<!-- radial size -->
<div class="slide object" id="radial05">
<header><h1>Size</h1></header>
<section class="content">
<pre contenteditable>.thisSlide {
background-image:
<span contenteditable id="radialfeature05" onKeyUp="changeBackgroundGradient('radial05','#radialfeature05')">radial-gradient(75% 75%,
farthest-corner,
#C7573A,
#BDD9D5)</span>;
}</pre>
<ul>
<li>closest-side</li>
<li>closest-corner</li>
<li>farthest-side</li>
<li class="imp">farthest-corner</li>
<li>contain (same as closest-side)</li>
<li>cover (same as farthest-corner)</li>
</ul>
</section>
</div>
<!-- effects1 -->
<div class="slide object" id="radial06">
<header><h1>with Background size</h1></header>
<section class="content">
<pre style="background-color: rgba(255,255,255,0.9)">.thisSlide {
background-image:
<span contenteditable id="radialfeature06" onKeyUp="changeBackgroundGradient('radial06','#radialfeature06')">radial-gradient(
circle,
#BDD9D5 50%,
#C7573A 50%)</span>;
background-size: <span id="radialfeature06b" onKeyUp="changeFeature('backgroundSize', 'radialfeature06b', 'radial06')" contenteditable>100px 100px, 100px 100px</span>;
background-repeat: <span id="radialfeature06c" onKeyUp="changeFeature('backgroundRepeat', 'radialfeature06c', 'radial06')" contenteditable>repeat</span>;
background-color: <span id="radialfeature06d" onKeyUp="changeFeature('backgroundColor', 'radialfeature06d', 'radial06')" contenteditable>red</span>;
}</pre>
</section>
</div>
<!-- NEXT -->
<div class="slide intro">
<header><h1>Part 10: Transforms</h1></header>
<h1><a href="part_10_transforms.html">Next ➹</a></h1>
</div>
</div>
</div>
<script src="css/slide.js"></script>
<script defer>
function changeFeature(changestyle, content, slide) {
document.getElementById(slide).style[changestyle] = document.getElementById(content).innerHTML;
}
function changeBackgroundGradient(pageID,changedText){
document.getElementById(pageID).style.backgroundImage = PrefixFree.prefix + document.querySelector(changedText).innerHTML;
}
</script>
<script src="css/prefixfree.js"></script>
</body>
</html>