-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1054 lines (997 loc) · 38.4 KB
/
index.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
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS3 Properties &s Selectors ♥ Girl Develop It Boulder</title>
<meta name="description" content="">
<meta name="author" content="Cara Jo Miller & Caitlin McKenna">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<link rel="stylesheet" href="reveal/css/reveal.css">
<link rel="stylesheet" href="reveal/css/theme/simple.css">
<!-- For syntax highlighting -->
<!-- light editor-->
<link rel="stylesheet" href="reveal/lib/css/light.css">
<!-- dark editor<link rel="stylesheet" href="reveal/lib/css/dark.css">-->
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'reveal/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<link rel="icon" type="image/x-icon" href="reveal/favicon.ico"/>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/icomoon.css">
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Opening -->
<section>
<img src="images/gdi_logo_badge.png" style="padding: 10px;"/>
<h2>CSS3 Properties & Selectors</h2>
</section>
<!-- Sample Slide -->
<!-- Sample Slide -->
<section>
<h2>Welcome!</h2>
<h4 class="blue">Wifi Info</h4>
<p><strong>Network:</strong> galvanize guest</p>
<p><strong>Password:</strong> login with your email or facebook account. </p><br/>
<h3>Download workshop files</h3>
<p>If you have not already downloaded the files for this workshop - please download them at <a href="http://gdiboulder.com/css-properties" target="blank">gdiboulder.com/css-properties</a></p>
<p>Slides are available at <a href="http://materials.gdiboulder.com" target="blank">materials.gdiboulder.com</a>. Click on "CSS Properties & Selectors".</p>
<p>Digital copy of the <a href="https://docs.google.com/document/d/1zeIbUlnuCJi4HUVToNZ6S-dyTzf6X0gHX6XP5aLmS5k/edit?usp=sharing" target="blank">Selectors Cheat Sheet</a>.</p>
</section>
<section>
<h2>Thanks to our sponsor:</h2>
<img src="images/sponsors/galvanize.jpg" style="border:none; width: 400px;"/>
</section>
<section>
<h2>Meet your instructor: Cara Jo Miller</h2>
<ul>
<li><strong>Co-founder:</strong> Girl Develop It Boulder</li>
<li><strong>Lead Designer:</strong> Simple Energy</li>
<li><strong>E-mail:</strong> [email protected]</li>
<li><strong>Twitter:</strong> @corrinajo</li>
<li>Lover of all things glitter</li>
</ul>
</section>
<section data-background="#f05b62">
<h2 style="color: #fafafa;">But first - let's have a recap.</h2>
</section>
<section>
<h3>CSS Recap</h3>
<p>The CSS rule:</p>
<pre><code class="css">
selector {
property: value;
property: value;
}</code></pre>
<p>Different properties & values:</p>
<pre><code class="css">
body {
color: yellow;
background-color: black;
}
p {
width: 70%;
padding: 10px;
margin: auto;
}
h1 {
font-size: 12px;
border-bottom: 1px solid #ccc;
}</code></pre>
</section>
<section>
<h3>Really basic selectors</h3>
<p>HTML:</p>
<pre><code class="html"><ul>
<li id="myID" class="myClass">item 1</li>
<li class="myClass">item 2</li>
<li>item 3</li>
</ul> </code></pre>
<p>CSS:</p>
<pre><code class="css">
#myID: ID
.myClass: Class
ul/li: Elements</code></pre>
</section>
<section>
<h3>Basic CSS Specificity</h3>
<pre><code class="css">
ul { font-weight: bold; }
li { color: magenta; }
.myClass { color: red; }
#myID { color: blue; font-weight: normal; font-style: italic;}
</code></pre>
<ul>
<li style="color: blue; font-style: italic;">Item 1</li>
<li style="font-weight: bold; color: red;">Item 2</li>
<li style="font-weight: bold; color: magenta;">Item 3</li>
</ul>
<p>Open <a href="examples/basic-selectors.html" target="blank">basic-selectors.html</a> in your browser.</p>
<p>Modify the CSS to see how Specificity works.</p>
</section>
<section>
<h2>CSS Specificity</h2>
<p>Specificity is the means by which a browser decides which property values are the most relevant to an element and gets to be applied. Specificity is only based on the matching rules which are composed of selectors of different sorts.</p>
<p>In case of specificity equality, the latest declaration found in the CSS is applied to the element.</p>
</section>
<section>
<h2>Say you have this:</h2>
<pre><code class="css">
.favorite {
color: red;
}
.favorite {
color: black;
}</code></pre>
<p>The color will be black because it comes last in the cascade</p>
</section>
<section>
<h2>Later on we declare this</h2>
<pre><code class="css">
ul#summer-drinks li.favorite {
color: green;
font-weight: bold;
}</code></pre>
<p>The color will now be green, because this is more specific that the previous declaration.</p>
</section>
<section>
<h2>Finally we get really specific</h2>
<pre><code class="css">html body div#pagewrap ul#summer-drinks li.favorite {
color: magenta;
font-weight: bold;
}</code></pre>
<p>The color will now be magenta, because this is the most specific of them all.</p>
</section>
<section>
<h2>But what if it's important?</h2>
<pre><code class="css">
.favorite {
color: orange !important;
font-weight: bold !important;
}</code></pre>
<p>The <code>!important</code> declaration is like a ninja and will force itself over all other declarations.</p>
<p><strong>This should be used sparingly</strong></p>
</section>
<section>
<h2>CSS Specificity Resources</h2>
<p><a href="http://www.standardista.com/wp-content/uploads/2012/01/specifishity1.pdf">An illustrated SpeciFISHity chart</a></p>
<p><a href="http://cssspecificity.com/">Another illustrated chart</a></p>
<p><a href="http://css-tricks.com/specifics-on-css-specificity/">CSS Tricks: Specifics on CSS Specificity</a></p>
<p><a href="http://specificity.keegan.st/">Specificity Calculator</a></p>
</section>
<section data-background="#f05b62">
<h2 style="color: #fafafa;">Let's talk about Selectors!</h2>
</section>
<section>
<h3>Many Selectors!!</h3>
<pre style="width:999px;"><code class="css">
* :before :root :enabled
E ::before :last-child :disabled
.class ::selection :only-child :checked
#id :after :nth-child() :indeterminate
E F ::after :nth-last-child() :default
E > F :first-letter :first-of-type :valid
E + F ::first-letter :last-of-type :invalid
E[attribute] :first-line :only-of-type :in-range
E[attribute=value] ::first-line :nth-of-type() :out-of-range
E[attribute~=value] E[attribute^=value] :nth-last-of-type() :required
E[attribute|=value] E[attribute$=value] :empty :optional
:first-child E[attribute*=value] :not() :read-only
:lang() E ~ F :target :read-write
</code></pre>
<p>Checkout <a href="http://caniuse.com/" target="blank">caniuse.com</a> for compatability across browsers.</p>
</section>
<section>
<h3>Relational Selectors & Combinators</h3>
<p>Advanced ways to target elements using basic selectors.</p>
<div class="left" style="width: 50%; text-align: left;">
<h5><strong><code>ul li, ol li</code>:</strong></h5>
<p>Descendant selector matches nested <code><li></code>s</p>
<h5><strong><code>ol > li</code></strong></h5>
<p>Child selector matches <code><li></code>s in <code><ol></code> but not nested <code><ul></code></p>
<h5><strong><code>li.hasaclass + li</code></strong></h5>
<p>Adjacent sibling</p>
<h5><strong><code>li.hasaclass ~ li</code></strong></h5>
<p>general sibling selector matches later siblings, but not nested.</p>
</div>
<div class="right" style="width: 45%;">
<img src="images/sibling-selectors.png" alt="" />
</div>
</section>
<section>
<h3>Attribute Selectors</h3>
<p><strong><code>element[attribute]</code></strong></p>
<p>Select elements containing the named attribute</p>
<pre><code class="css">
img[alt] {}
<img src="image.jpg" alt="accessible">
<img src="image.jpg" title="inaccessible">
form [type] {}
<input type=date>
<select>
</code></pre>
</section>
<section>
<h3>Older Attribute Selectors</h3>
<p><strong><code>E[attr]</code></strong></p>
<p>Element E that has the attribute attr with any value.</p>
<pre><code class="css">
a[href] {
background: pink;
}
/* Styles all links with the attribute 'href' */
</code></pre>
<p><strong><code>E[attr="val"]</code></strong></p>
<p>Element E that has the attribute attr with the exact, case-sensitive if attribute is case sensitive, value val.</p>
<pre><code class="css">
a[href="http://girldevelopit.com"] {
background: magenta; font-weight: bold;
}
/* Styles all links to http://girldevelopit.com */
</code></pre>
</section>
<section>
<h3>Older Attribute Selectors</h3>
<p><strong><code>E[attr|=val]</code></strong></p>
<p>Element E whose attribute attr has a value val or begins with val- ("val" plus "-").</p>
<pre><code class="css">
p[lang|="en"]
{background: url(icon-flag.png);
}
/* Syles elements <p lang="en-us"> OR <p lang="en-uk"> */
</code></pre>
<p><strong><code>E[attr~=val]</code></strong>
<p>Element E whose attribute attr has within its value the space-separated full word val.</p>
<pre><code class="css">
a[title~=more] {
color: orange;
}
/* Styles links that have a title that contain 'more'
surrounded by spaces. <a title="want more info about this?"> */</code></pre>
</section>
<section>
<h3>CSS3 Attribute Selectors</h3>
<p><strong><code>E[attr^=val]</code></strong></p>
<p>Element E whose attribute attr starts with the value val.</p>
<pre><code class="css">
a[href^=mailto] {background-image: url(emailicon.gif);}
a[href^=http]:after {content: " (" attr(href) ")";}</code></pre>
<p><strong><code>E[attr$=val]</code></strong></p>
<p>Element E whose attribute attr ends in val .</p>
<pre><code class="css">
a[href$=pdf] {background-image: url(pdficon.gif);}
a[href$=pdf]:after {content: " (PDF)";}</code></pre>
<p><strong><code>E[attr*=val]</code></strong></p>
<p>Element E whose attribute attr matches val anywhere within the attribute.</p>
<p><strong>Note: Multiple attributes work! <code>a[title][href]</code></strong></p>
</section>
<section>
<h3>Attribute Selectors</h3>
<p>To review</p>
<pre><code class="css">
input[placeholder] {} E:[attr]
input[type=email] {} E:[att=val]
abbr[title~=unicorn] {} E:[att~=val]
abbr[title|=en] {} E:[att|=val]
a[href^=mailto] {} E:[att^=val]
a[href$=pdf]{} E:[att$=val]
abbr[title*=unicorn] {} E:[att*=val]
</code></pre>
<p>Don't forget, you can use Attribute Selectors in Media Queries</p>
<pre><code class="css">
@media print{
abbr[title]:after {
content: "(" attr(title) ")";
}
a[href^=http]:after {
content: "(" attr(href) ")";
}
}
</code></pre>
</section>
<section>
<h3>Using Attribute Selectors</h3>
<p>Open <a href="examples/attribute-selectors.html" target="blank">attribute-selectors.html</a> in your web browser.</p>
<p>Change the CSS and see what happens.</p>
</section>
<section>
<h2>UI pseudo-classes</h2>
<p>Based on the current state of the UI</p>
<pre><code class="css">
:enabled
:disabled
:checked
:focus
</code></pre>
<pre><code class="html">
input[type=checkbox]:checked + label {
color: red;
}</code></pre>
</section>
<section>
<h2>Form related UI pseudo-classes</h2>
<pre><code class="css">
valid :in-range
:invalid :out-of-range
:required :read-only
:optional :read-write
:default</code></pre>
<p>Examples:</p>
<pre><code class="css">
input:valid { border: 1px solid green;}
input:invalid { border: 1px solid red;}
input:required {border-width: 5px;}
input:optional {border-width: 10px;}
input:out-of-range { background-color: pink;}
input:in-range { background-color:lightgreen;}
</code></pre>
</section>
<section>
<h2>Using UI Selectors</h2>
<p>Open <a href="examples/ui-selectors.html" target="blank">ui-selectors.html</a> in your web browser.</p>
<p>Change the CSS and click the checkboxes to see how the form UI changes.</p>
</section>
<section>
<h2>Structural Selectors</h2>
<pre><code class="css">
:nth-child() :first-of-type
:nth-last-child() :last-of-type
:nth-of-type() :only-child
:nth-last-of-type() :only-of-type
:first-child* :root
:last-child :empty
:not(:empty)
</code></pre>
<p>Target elements on the page based on their relationships to other elements in the DOM.</p>
<p>Updates dynamically if page updates.</p>
<p>Reduced need for extra markup, classes and IDs</p>
</section>
<section>
<h2>Using Structural Selectors</h2>
<p>Open <a href="examples/structural-selectors.html" target="blank">structural-selectors.html</a> in your browser.</p>
<p>Experiment with targetting different element on the page with Structural Selectors.</p>
</section>
<section>
<h2>nth pseudo-classes</h2>
<p>Target element or elements based on argument passed to the selector</p>
<pre><code class="css">
:nth-child(3n)
:nth-last-child(odd)
:nth-of-type(5)
:nth-last-of-type(3n+1)
:nth-of-type(even)
:nth-of-type(odd)
:nth-of-type(an+b)</code></pre>
</section>
<section>
<h2>Getting crazy with Structural Selectors!</h2>
<div class="left" style="width: 45%;">
<pre><code class="css">
li:first-child,
li:last-child {
font-weight: bold;
}
li:first-of-type,
li:last-of-type{
text-decoration:line-through;
}
li:nth-child(even) {
background-color: #CCC;
}
li:nth-child(3) {
color: #CCC;
}
li:nth-of-type(odd) {
background-color: #FFF;
}
li:nth-of-type(4n) {
color: hsl(205, 87%, 50%);
}
li:nth-of-type(3n-1) {
text-align: right;
}</code></pre></div>
<div class="right" style="width: 45%;">
<img src="images/structural-selectors.png">
</div>
</section>
<section>
<h2>nth-child to the nth-degree of confusion</h2>
<p>Nth-child can be very confusing. Here's some resources:</p>
<p><a href="http://css-tricks.com/how-nth-child-works/">CSS Tricks: How nth-child works</a></p>
<p><a href="http://nthmaster.com/">Mastering the nth-child</a></p>
<p><a href="http://caniuse.com/#search=nth-child">Nth-child browser support</a></p>
</section>
<section>
<h2>Use nth-child</h2>
<p>Open <a href="examples/nth-child-selectors.html" target="blank">nth-child-selectors.html</a> in your browser.</p>
<p>Change the values of the nth-child to see what cells change colors</p>
</section>
<section>
<h2>Go crazy!</h2>
<p>Open <a href="examples/css-flag.html" target="blank">flag.html</a> and see how crazy you can get with nth-child selectors.</p>
</section>
<section>
<h2>Misc. Pseudo Classes</h2>
<p>These should be familar.</p>
<pre><code class="css">
:link
:visited
:hover
:active
:focus
:not
:empty
:lang
:target</code></pre>
</section>
<section>
<h2>Using the :not selector</h2>
<p>The <code>:not</code> selector creates an argument using a simple selector and then matches elements on the page that do <strong>not</strong> match that element.</p>
<p>Open <a href="examples/not-selector.html" target="blank">not-selector.html</a> in your browser</p>
<p>Try using our previous selectors to styles things (or not!).</p>
</section>
<section>
<h2>Pseudo Elements</h2>
<p><strong>Pseudo classes</strong> select elements that already exist</p>
<p><strong>Pseudo Elements</strong> create fake elements you can style.</p>
</section>
<section>
<h2>::first-letter</h2>
<pre><code class="css">
p:first-of-type::first-letter {
position: relative;
top: 8px;
float: left;
font-size: 3em;
line-height: 1;
color: magenta;
padding: 0 4px 2px 0;
font-weight: bold;
}</code></pre>
<p>Open <a href="examples/first-letter.html">first-letter.html</a> to play with this pseudo-element.</p>
</section>
<section>
<h2>Using ::after & ::before</h2>
<p>You can use ::after and ::before in combination with 'content' to add some elements to your page without having to edit the HTML</p>
<pre><code class="css">
.triangle-border {
position:relative;
padding:15px;
margin:1em 0 3em;
border:5px solid #5a8f00;
color:#333;
background:#fff;
}
.triangle-border::before {
content:"";
position:absolute;
bottom:-20px;
left:40px;
border-width:20px 20px 0;
border-style:solid;
border-color:#5a8f00 transparent;
}
.triangle-border::after {
content:"";
position:absolute;
bottom:-13px;
left:47px;
border-width:13px 13px 0;
border-style:solid;
border-color:#fff transparent;
}</code></pre>
<p>Open <a href="examples/after-before.html" target="blank">after-before.html</a> to see this in action.</p>
</section>
<section>
<h2>Icon fonts use ::before</h2>
<p>Icon fonts use ::before to insert a unicode character with 'content' that is associated with a glyph in that font.</p>
<pre><code class="css">
.icon-search:before {
content: "\f002";
}
.icon-envelope-o:before {
content: "\f003";
}
.icon-heart:before {
content: "\f004";
}</code></pre>
<p><i>::beore and :before are often interchangable.</i></p>
</section>
<section data-background="#f05b62">
<h2 style="color: #fafafa;">Properties</h2>
</section>
<section>
<h2>Vendor Prefixes</h2>
<p>Don't forget, when using fancy CSS3 properties you need to add the vendor prefixes so all browsers can play.</p>
<pre><code class="css">
selector {
property: value;
-webkit-property: value;
-moz-property: value;
-ms-property: value;
-o-property: value;
}
</code></pre>
<pre><code class="css">
div {
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
}
</code></pre>
</section>
<section>
<h2>Text Stroke</h2>
<style>
#text-stroke-example {
font-size: 85px;
font-family: helvetica;
font-weight: bold;
padding: 20px 0;
text-align: center;
-webkit-text-stroke-color: magenta;
-webkit-text-fill-color: black;
}
</style>
<pre>div {
-webkit-<b>text-fill-color</b>: black;
-webkit-<b>text-stroke-color</b>: magenta;
-webkit-<b>text-stroke-width</b>: <span id="text-stroke-value">0.00</span>px; <input id="text-stroke" type="range" min="0" max="50" value="0" onchange="changeTextStroke()">
}</pre>
<div id="text-stroke-example" class="example">
You Be Strokin'!
</div>
<script defer>
function changeTextStroke() {
var width = (document.getElementById('text-stroke').value * 0.25).toFixed(2);
document.getElementById('text-stroke-example').style.webkitTextStrokeWidth = width + 'px';
document.getElementById('text-stroke-value').textContent = width;
}
</script>
</section>
<section>
<h2>Opacity with RGBA values</h2>
<style>
#opacity-body {
font-size: 84%;
max-width: 800px;
background: url(http://placekitten.com/800/400) top center no-repeat;
margin: 0 auto;
padding: 20px;
-webkit-border-radius: 8px;
-khtml-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#opacity-example {
margin: 100px auto;
font-size: 80px;
line-height: 200px;
text-align: center;
font-weight: bold;
letter-spacing: -4px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-shadow: none;
color: rgba(255, 0, 0, 0.746094);
background-image: initial;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: rgba(0, 0, 255, 0.746094);
background-position: initial initial;
background-repeat: initial initial;
}
</style>
<pre> color: <b>rgba</b>(255, 0, 0, <span id="opacity-color-value">0.75</span>); <input id="opacity-color" type="range" min="0" max="100" value="75" onchange="changeOpacity()">
background: <b>rgba</b>(0, 0, 255, <span id="opacity-background-value">0.75</span>); <input id="opacity-background" type="range" min="0" max="100" value="75" onchange="changeOpacity()">
</pre>
<div id="opacity-body">
<div id="opacity-example">
Independent opacity
</div>
</div>
<script defer>
function changeOpacity() {
var textOpacity = (document.getElementById('opacity-color').value / 100).toFixed(2);
var backgroundOpacity = (document.getElementById('opacity-background').value / 100).toFixed(2);
var el = document.getElementById('opacity-example');
el.style.color = 'rgba(255, 0, 0, ' + textOpacity + ')';
el.style.background = 'rgba(0, 0, 255, ' + backgroundOpacity + ')';
document.getElementById('opacity-color-value').textContent = textOpacity;
document.getElementById('opacity-background-value').textContent = backgroundOpacity;
}
changeOpacity();
</script>
</section>
<section>
<h2>Hue Saturation Luminance</h2>
<style>
#hsl-example {
font-size: 75px;
font-weight: bold;
padding-top: 20px;
padding-right: 0px;
padding-bottom: 20px;
padding-left: 0px;
text-align: center;
color: rgb(21, 147, 38);
}
.hsl-value {
display: inline-block;
width: 50px;
}
</style>
<pre>color: <b>hsla</b>(
<span class="hsl-value" id="hsl-h-value">128,</span> <input id="hsl-h" type="range" min="0" max="360" value="128" onchange="changeHSL()">
<span class="hsl-value" id="hsl-s-value">74%,</span> <input id="hsl-s" type="range" min="0" max="100" value="75" onchange="changeHSL()">
<span class="hsl-value" id="hsl-l-value">33%,</span> <input id="hsl-l" type="range" min="0" max="100" value="33" onchange="changeHSL()">
<span class="hsl-value" id="hsl-a-value">1.00</span> <input id="hsl-a" type="range" min="0" max="100" value="100" onchange="changeHSL()">
</pre>
<div id="hsl-example" class="example">
Girl Develop It Rocks!
</div>
<script defer>
function changeHSL() {
var h = document.getElementById('hsl-h').value * 1.0;
var s = document.getElementById('hsl-s').value * 1.0;
var l = document.getElementById('hsl-l').value * 1.0;
var a = (document.getElementById('hsl-a').value / 100).toFixed(2);
var el = document.getElementById('hsl-example');
el.style.color = 'hsla(' + h + ', ' + s + '%, ' + l + '%, ' + a + ')';
document.getElementById('hsl-h-value').textContent = h + ',';
document.getElementById('hsl-s-value').textContent = s + '%,';
document.getElementById('hsl-l-value').textContent = l + '%,';
document.getElementById('hsl-a-value').textContent = a + ');';
}
changeHSL();
</script>
</section>
<section>
<h2>CSS Gradients</h2>
<style>
#gradients-linear-example {
border: 0;
height: 100px;
background: -moz-linear-gradient(90deg, #00abeb, #fff, #66cc00, #fff);
background: -webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff), color-stop(0.5, #fff), color-stop(0.5, #66cc00));
}
#gradients-radial-example {
border: 0;
height: 100px;
background: -moz-radial-gradient(430px 50px, circle cover, red 0, #000 200px);
background: -webkit-gradient(radial, 430 50, 0, 430 50, 200, from(red), to(#000));
}
</style>
<pre>background-image: <b>linear-gradient</b>(to bottom, <span style="text-shadow: #00abeb 0 0 1px; color: #00abeb">#00abeb</span> 0%, #fff 50%,
<span style="text-shadow: #00abeb 0 0 1px; color: #66cc00">#66cc00</span> 50%, #fff 100%);
</pre>
<div id="gradients-linear-example" class="example"></div>
<br />
<pre>background-image: <b>radial-gradient</b>(center, circle cover, red, #000 <span id="gradients-radial-value">40</span>%);
<input id="gradients-radial" type="range" min="1" max="100" value="40" onchange="changeGradients(event)">
</pre>
<div id="gradients-radial-example" class="example"></div>
<script defer>
function changeGradients() {
var size = document.getElementById('gradients-radial').value;
document.getElementById('gradients-radial-example').style.backgroundImage =
'-webkit-radial-gradient(center, circle cover, red, #000 ' + size + '%)';
document.getElementById('gradients-radial-value').textContent = size;
}
</script>
</section>
<section>
<h2>CSS3 Shadows</h2>
<style>
#shadow-example {
font-size: 75px;
margin: 10px 10px 30px 10px;
padding: 20px;
text-align: center;
}
</style>
<pre class="two-column"><b>text-shadow</b>:
rgba(64, 64, 64, 0.5)
<span id="shadows-text-x-value">0</span>px <input id="shadows-text-x" type="range" min="-9" max="9" value="0" onchange="changeShadow(event)">
<span id="shadows-text-y-value">0</span>px <input id="shadows-text-y" type="range" min="-9" max="9" value="0" onchange="changeShadow(event)">
<span id="shadows-text-size-value">0</span>px; <input id="shadows-text-size" type="range" min="0" max="9" value="0" onchange="changeShadow(event)">
<br><b>box-shadow</b>:
rgba(0, 0, 128, 0.25)
<span id="shadows-box-x-value">0</span>px <input id="shadows-box-x" type="range" min="-9" max="9" value="0" onchange="changeShadow(event)">
<span id="shadows-box-y-value">0</span>px <input id="shadows-box-y" type="range" min="-9" max="9" value="0" onchange="changeShadow(event)">
<span id="shadows-box-size-value">0</span>px; <input id="shadows-box-size" type="range" min="0" max="9" value="0" onchange="changeShadow(event)">
</pre>
<div id="shadow-example" class="example">
Such a shady div.
</div>
<script defer>
function changeShadow() {
var el = document.getElementById('shadow-example');
var textXVal = document.getElementById('shadows-text-x').value;
var textYVal = document.getElementById('shadows-text-y').value;
var textSizeVal = document.getElementById('shadows-text-size').value;
document.getElementById('shadows-text-x-value').textContent = textXVal;
document.getElementById('shadows-text-y-value').textContent = textYVal;
document.getElementById('shadows-text-size-value').textContent = textSizeVal;
var boxXVal = document.getElementById('shadows-box-x').value;
var boxYVal = document.getElementById('shadows-box-y').value;
var boxSizeVal = document.getElementById('shadows-box-size').value;
document.getElementById('shadows-box-x-value').textContent = boxXVal;
document.getElementById('shadows-box-y-value').textContent = boxYVal;
document.getElementById('shadows-box-size-value').textContent = boxSizeVal;
el.style.textShadow = 'rgba(64, 64, 64, 0.5) ' + textXVal + 'px ' + textYVal + 'px ' + textSizeVal + 'px';
el.style.webkitBoxShadow = 'rgba(0, 0, 128, 0.25) ' + boxXVal + 'px ' + boxYVal + 'px ' + boxSizeVal + 'px';
el.style.MozBoxShadow = 'rgba(0, 0, 128, 0.25) ' + boxXVal + 'px ' + boxYVal + 'px ' + boxSizeVal + 'px';
}
</script>
</section>
<section>
<h2>Web Fonts</h2>
<style>
@font-face {
font-family: 'alpha_echoregular';
src: url('fonts/alpha_echo-webfont.eot');
src: url('fonts/alpha_echo-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/alpha_echo-webfont.woff') format('woff'),
url('fonts/alpha_echo-webfont.ttf') format('truetype'),
url('fonts/alpha_echo-webfont.svg#alpha_echoregular') format('svg');
font-weight: normal;
font-style: normal;
}
.special-header {
font-family: 'alpha_echoregular'!important;
font-size: 60px;
}
</style>
<pre>
@font-face {
font-family: 'alpha_echoregular';
src: url('fonts/alpha_echo-webfont.eot');
src: url('fonts/alpha_echo-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/alpha_echo-webfont.woff') format('woff'),
url('fonts/alpha_echo-webfont.ttf') format('truetype'),
url('fonts/alpha_echo-webfont.svg#alpha_echoregular') format('svg');
font-weight: normal;
font-style: normal;
}
.special-header {
font-family: 'alpha_echoregular';
}</pre>
<div class="special-header">
<span>Look, I'm in Alpha Echo Regular font!</span>
</div>
</section>
<section>
<h2>Finding Web Fonts</h2>
<ul>
<li><a href="http://www.google.com/webfonts/">Google Web Fonts</a>
</li><li><a href="http://www.typetester.org/">TypeTester</a>
</li><li><a href="http://typekit.com/">TypeKit</a>
<li><a href="http://openfontlibrary.org/">OpenFont Library</a></li>
</li><li><a href="http://www.typotheque.com/fonts/">Typotheque</a>
</li><li><a href="http://whatthefont.com">whatthefont.com</a></li>
<li><a href="http://www.fontsquirrel.com/fontface/generator">Font Squirrel's Font-face generator</a></li>
</ul>
</section>
<section>
<h2>Transition</h2>
<style>
#box-2 {
-webkit-transition: background 1s ease-in-out;
-moz-transition: background 1s ease-in-out;
-ms-transition: background 1s ease-in-out;
-o-transition: background 1s ease-in-out;
transition: background 1s ease-in-out;
}
#box-1, #box-2 {
background: magenta;
}
#box-1:hover, #box-2:hover {
background: lime;
}
{height: 50px; width: 100%; border: 1px solid black;}
.transitions div {
width: 300px;
height: 200px;
margin: 20px; float: left;
color: white; padding-top: 100px; text-align: center; cursor: pointer;
}
</style>
<pre><code class="css">
#box-1, #box-2 {
background: magenta;
}
#box-1:hover, #box-2:hover {
background: lime;
}
#box-2 {
-webkit-transition: background 1s ease-in-out;
-moz-transition: background 1s ease-in-out;
-ms-transition: background 1s ease-in-out;
-o-transition: background 1s ease-in-out;
transition: background 1s ease-in-out;
}
</code></pre>
<div class="transitions example">
<div id="box-1">#box-1</div>
</div>
<div class="transitions example">
<div id="box-2">#box-2</div>
</div>
</section>
<section>
<h2>Transformations</h2>
<style>
#threed-example {
margin: 50px 20px;
-webkit-transform: rotateZ(5deg);
-moz-transform: rotateZ(5deg);
-o-transform: rotateZ(5deg);
transform: rotateZ(5deg);
-webkit-transition: -webkit-transform 2s ease-in-out;
-moz-transition: -moz-transform 2s ease-in-out;
-o-transition: -o-transform 2s ease-in-out;
transition: transform 2s ease-in-out;
}
#threed-example:hover {
-webkit-transform: rotateZ(-5deg);
-moz-transform: rotateZ(-5deg);
-o-transform: rotateZ(-5deg);
transform: rotateZ(-5deg);
}
</style>
<p class="center">
Hover over me:
</p>
<pre id="threed-example">-webkit-<b>transform</b>: <b>rotateY</b>(45deg);
-webkit-transform: <b>scaleX</b>(25deg);
-webkit-transform: <b>translate3d</b>(0, 0, 90deg);
-webkit-transform: <b>perspective</b>(500px)
</pre>
<pre>#threed-example {
-webkit-transform: rotateZ(5deg);
-webkit-transition: -webkit-transform 2s ease-in-out;
}
#threed-example:hover {
-webkit-transform: rotateZ(-5deg);
}
</pre>
</section>
<section>
<h2>Animations</h2>
<style>
/* put the keyframes rule here cuz ExCss currently doesn't support '@-webkit-keyframes' */
@-webkit-keyframes pulse {
from {
opacity: 0.0;
font-size: 50px;
}
to {
opacity: 1.0;
font-size: 100px;
}
}
#animation-example {
-webkit-animation-name: pulse;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-direction: alternate;
}
</style>
<pre>@-webkit-<b>keyframes</b> <em>pulse</em> {
<b>from</b> {
opacity: 0.0;
font-size: 100%;
}
<b>to</b> {
opacity: 1.0;
font-size: 200%;
}
}
div {
-webkit-<b>animation-name</b>: <em>pulse</em>;
-webkit-<b>animation-duration</b>: 2s;
-webkit-<b>animation-iteration-count</b>: infinite;
-webkit-<b>animation-timing-function</b>: ease-in-out;
-webkit-<b>animation-direction</b>: alternate;
}
</pre>
<div id="animation-example" class="example">
Pulse!
</div>
</section>
<section>
<h2>That's it!</h2>
<p>Use your new powers for good! </p>
</section>
<section>
<h2>Upcoming Events</h2>
<h4><strong>Intro to Command Line</strong></h4>
<p>October 15th. 6p - 8p</p>
<p>Galvanize - Boulder</p><br/>
<h4><strong>Code & Coffee</strong></h4>
<p>October 18th. 10a - 1p</p>
<p>Amante Coffee Baseline - Boulder</p><br/>
<h4><strong>Intro to Programming with Ruby</strong></h4>
<p>October 25th. 9a-5:30p</p>
<p>Turing School - Denver</p>
</section>
</div>
<footer>
<div class="copyright">
CSS3 Properties & Selectors ♥ Girl Develop It Boulder --
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US">
<img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/80x15.png" />