-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.2013.html
1167 lines (960 loc) · 33.9 KB
/
index.2013.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>
<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>Selectors: Select This!</title>
<link href='http://fonts.googleapis.com/css?family=Rum+Raisin' rel='stylesheet'>
<link href='http://fonts.googleapis.com/css?family=Bigelow+Rules' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="white.css"/>
<style>
.current * { -webkit-tap-highlight-color: #bada55;}
.thisSlide.foo {
-webkit-tap-highlight-color: #bada55;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.beforeafter:before {
content: "before - ";
font-weight: bold;
}
.beforeafter:after {
content: " - after";
font-weight: bold;
}
.active {color: red; font-weight: bold; background-color: rgba(0,0,0,0.3)}
#presentation {-webkit-animation: none; background-image: none;}
</style>
</head>
<body>
<!-- Top instructions -->
<div id="topinfo"></div>
<!-- footer instructions -->
<div id="info">
<p><a href="http://standardista.com">Estelle Weyl</a> | <a href="http://twitter.com/estellevw">@estellevw</a> | <a href="http://github.com/estelle">Github</a> | Press <span class="key">→</span> key to advance.</p>
</div>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<div class="slide intro">
<header><hgroup>
<h1><span class="textmask">Select This!</span><br> CSS Selectors</h1>
</hgroup></header>
<p><a href="http://estelle.github.com/selectors/" style="color: #000">http://estelle.github.com/selectors/</a></p>
</div>
<div class="slide normal">
<header><h1>Me</h1></header>
<section class="content">
<h1 class="textmask">Estelle Weyl</h1>
<h2><a href="http://www.standardista.com">www.standardista.com</a></h2>
<h2><a href="http://www.twitter.com/estellevw">@estellevw</a></h2>
<h2><a href="http://www.twitter.com/standardista">@standardista</a></h2>
<div style="float:right">
<img src="http://akamaicovers.oreilly.com/images/9780980846904/cat.gif" alt="HTML5 and CSS3 for the Real World">
<img src="http://akamaicovers.oreilly.com/images/0636920018063/cat.gif" alt="HTML5: The Definitive Guide" style="margin: 0 20px;"/>
<img src="http://akamaicovers.oreilly.com/images/0636920021711/cat.gif" alt="MObile HTML5" style="margin: 0 20px;"/>
<img src="http://akamaicovers.oreilly.com/images/0636920025955/cat.gif" alt="Web Performance Daybook"/>
</div>
</section>
</div>
<!-- basics -->
<div class="slide normal">
<header><h1>Selectors</h1></header>
<section class="content">
<pre contenteditable style="font-size:100%; line-height:1.5">selectorA {
property1: value1;
property2: value2;
}
selectorB {
property1: value3;
property2: value4;
}</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Selectors</h1></header>
<section class="content">
<pre contenteditable style="font-size:100%; line-height:1.5">selector:pseudo-class::pseudo-element {
-vendor-property: value;
}
selector[attribute],
selector ~ relation {
property: -vendor-value;
-vendor-property: -vendor-value;
-vendor-property: weirdsyntax;
}</pre>
</section>
</div>
<!-- Basic Selectors-->
<div class="slide normal light" id="slcElement">
<header><h1>Basic Selectors</h1></header>
<section class="content">
<pre contenteditable style="font-size:100%; line-height:1.5"><ul>
<li id="myID" class="myClass">item 1</li>
<li class="myClass">item 2</li>
<li>item 3</li>
</ul> </pre>
<dl class="inline">
<dt><b class="imp">#</b>myID</dt>
<dd>ID</dd>
<dt><b class="imp">.</b>myClass</dt>
<dd>class</dd>
<dt class="imp">li</dt>
<dd>tag name</dd>
</dl>
</section>
</div>
<div class="slide object">
<header><h1>Play Time</h1></header>
<object data="files/00_basics.html"></object>
<a href="files/00_basics.html" target="play" class="objectlink">Try it out</a>
</div>
<div class="slide normal">
<header><h1>Selectors API</h1></header>
<section class="content">
<pre contenteditable>var chil = $('#bar .foo');</pre>
<p>Natively</p>
<pre contenteditable>var el = document.<strong>querySelector</strong>('#bar');
var chil = el.<strong>querySelectorAll</strong>('.foo');</pre>
<p>or</p>
<pre contenteditable>chil = document.<strong>querySelectorAll</strong>('#bar .foo');</pre>
</section>
</div>
<!-- Relational selectors -->
<div class="slide normal" id="slcRelational">
<header><h1>Relational selectors & Combinators</h1></header>
<section class="content">
<div class="ex right">
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3
<ul>
<li>item a</li>
<li>item b</li>
<li>item c</li>
</ul>
</li>
<li class="hasaclass">hasaclass</li>
<li>item 5</li>
<li>item 6</li>
<li>item 7</li>
</ol>
</div>
<dl>
<dt><span onclick="hasaclass('ul li');">ul li</span>, <br><span onclick="hasaclass('ol li');">ol li</span></dt>
<dd>descendant selector<br />
matches nested <li>s
</dd>
<dt onclick="hasaclass('ol > li');">ol > li</dt>
<dd><em>child selector</em> <br />
matches <li>s in <ol> but not nested <ul></dd>
<dt onclick="hasaclass('li.hasaclass + li');">li.hasaclass + li</dt>
<dd><em>adjacent sibling</em> </dd>
<dt onclick="hasaclass('li.hasaclass ~ li');"><strong class="new">NEW </strong><span style="background-color:#eee; padding:3px 20px; position:relative; left: 22px; margin-left: -20px;">(IE7+)</span><br />
li.hasaclass ~ li</dt>
<dd><em>general sibling selector</em><br />
matches later siblings, but not nested.</dd>
</dl>
</section>
<script defer>
function hasaclass(selector) {
var i = j = 0,
elements = document.querySelectorAll('.current .ex li'),
update = document.querySelectorAll('.current .ex ' + selector);
for (; i < elements.length; i++) {
elements[i].classList.remove('active');
}
for (; j < update.length; j++) {
update[j].classList.add('active');
}
}
</script>
</div>
<!-- CSS4: Attribute Selector -->
<div class="slide">
<header>
<h1>CSS Selectors 4: Combinators</h1>
</header>
<section class="content">
<p>Reference combinator</p>
<pre>E /attr/ F</pre>
<pre>label /for/ input</pre>
<p>Parent selector</p>
<pre>E! > F</pre>
<a href="http://codepen.io/estelle/pen/lEGev" target="_play"></a>
</section>
</div>
<!-- How we did the previous slide -->
<div class="slide">
<header>
<h1>In case you were wondering...</h1>
</header>
<section class="content">
<pre contenteditable>
function hasaclass(slctr){
var i = j = 0,
elements = document.<strong>querySelectorAll</strong>('.cur .ex li'),
cur = document.<strong>querySelectorAll</strong>('.cur .ex ' + slctr);
for (; i < elements.length; i++){
elements[i].<strong>classList.remove</strong>('active');
}
for (; j < cur.length; j++){
cur[j].<strong>classList.add</strong>('active');
}
} </pre>
</section>
</div>
<!-- Play time
<div class="slide object">
<header>
<h1>Play Time</h1>
</header>
<object data="files/00_basic.html"></object>
<a href="files/00_basic.html" target="play" class="objectlink">Try it out</a>
</div>
<!-- Selector list -->
<div class="slide normal">
<header>
<h1>Lots 'o Selectors</h1>
</header>
<section class="content">
<ul class="columns">
<li>*</li>
<li>E</li>
<li>.class</li>
<li>#id</li>
<li>E F</li>
<li>E > F</li>
<li>E + F</li>
<li>E[attribute]</li>
<li>E[attribute=value]</li>
<li>E[attribute~=value]</li>
<li>E[attribute|=value]</li>
<li>:first-child</li>
<li>:lang()</li>
<li>:before</li>
<li>::before</li>
<li>::selection</li>
<li>:after</li>
<li>::after</li>
<li>:first-letter</li>
<li>::first-letter</li>
<li>:first-line</li>
<li>::first-line</li>
<li>E[attribute^=value]</li>
<li>E[attribute$=value]</li>
<li>E[attribute*=value]</li>
<li>E ~ F</li>
<li>:root</li>
<li>:last-child</li>
<li>:only-child</li>
<li>:nth-child()</li>
<li>:nth-last-child()</li>
<li>:first-of-type</li>
<li>:last-of-type</li>
<li>:only-of-type</li>
<li>:nth-of-type()</li>
<li>:nth-last-of-type()</li>
<li>:empty</li>
<li>:not()</li>
<li>:target</li>
<li>:enabled</li>
<li>:disabled</li>
<li>:checked</li>
<li>:indeterminate</li>
<li>:default</li>
<li>:valid</li>
<li>:invalid</li>
<li>:in-range</li>
<li>:out-of-range</li>
<li>:required</li>
<li>:optional</li>
<li>:read-only</li>
<li>:read-write</li>
</ul>
</section>
</div>
<!-- Standardista: selector support grid -->
<div class="slide object">
<object data="http://www.standardista.com/css3/css3-selector-browser-support/"></object>
<a href="http://www.standardista.com/css3/css3-selector-browser-support/"class="objectlink">Standardista</a>
</div>
<!-- Attribute selectors-->
<div class="slide normal">
<header>
<h1>Attribute selectors</h1>
</header>
<section class="content">
<dl>
<dt>element[attribute]</dt>
<dd>Select elements containing the named attribute</dd>
</dl>
<pre contenteditable style="font-size: 95%;"><strong>img[alt] {}</strong>
<img src="image.jpg" <strong>alt</strong>="accessible">
<span style="opacity:0.3"><img src="image.jpg" title="inaccessible"></span>
<strong>form [type] {}</strong>
<input <strong>type</strong>=date>
<span style="opacity:0.3"><select></span></pre>
<p><small>IE6 sucks <br />
IE7 support basic non-empty attribute</small></p>
</section>
</div>
<!-- Older attribute selectors -->
<div class="slide normal">
<header style="position:absolute; top: 20px; right: 20px;">
<h1>Older attribute selectors</h1>
</header>
<section class="content">
<dl>
<dt>E[attr]</dt>
<dd>Element E that has the attribute attr with any value.</dd>
<dt>E[attr="val"]</dt>
<dd>Element E that has the attribute attr with the exact, case-sensitive if attribute is case sensitive, value <em>val</em>.</dd>
<dt>E[attr|=val]</dt>
<dd>Element E whose attribute <em>attr</em> has a value <em>val</em> or begins with val- ("val" plus "-").<br />
<pre contenteditable class="example">p[lang|="en"]{/* <p lang="en-us"> <p lang="en-uk"> */ }</pre>
</dd>
<dt>E[attr~=val]</dt>
<dd>Element E whose attribute <em>attr</em> has within its value the space-separated full word <em>val</em>.<br />
<pre contenteditable class="example">a[title~=more] {/* <a title="want more info about this?">}</pre>
</dd>
</dl>
</section>
</div>
<!-- CSS3 Attribute Selectors -->
<div class="slide normal">
<header style="position:absolute; top: 20px; right: 20px;"><h1>CSS3 Attribute Selectors</h1></header>
<section class="content">
<dl>
<dt>E[attr^=val]</dt>
<dd>Element E whose attribute <em>attr</em> starts with the value <em>val</em>.<br />
<pre contenteditable class="example">a[href^=mailto] {background-image: url(emailicon.gif);}
a[href^=http]:after {content: " (" attr(href) ")";}</pre>
</dd>
<dt>E[attr$=val]</dt>
<dd>Element E whose attribute <em>attr</em> ends in <em>val</em> . <br />
<pre contenteditable class="example">a[href$=pdf] {background-image: url(pdficon.gif);}
a[href$=pdf]:after {content: " (PDF)";}</pre>
</dd>
<dt>E[attr*=val]</dt>
<dd>Element E whose attribute <em>attr </em>matches <em>val</em> anywhere within the attribute. Similar to E[attr~=val] above, except the <em>val</em> can be part of a word.</dd>
</dl>
<p>Note: Multiple attributes work! a[title][href]</p>
</section>
</div>
<!-- Attribute Selectors Recap -->
<div class="slide normal">
<header><h1>Attribute Selectors Recap</h1></header>
<section class="content">
<pre contenteditable style="float:left; width: 45%; margin: 0 20px 0 0;">
input[placeholder] {
<b class="notes">/* matches any input with a placeholder */</b>}
input[type=email] {
<b class="notes">/* exact match */</b>}
abbr[title~=unicorn] {
<b class="notes">/* matches unicorn but not unicorns */</b>}
abbr[title|=en] {
<b class="notes">/* matches en-us and en-uk */</b>}
a[href^=mailto] {
<b class="notes">/* starts with */</b>}
a[href$=pdf]{
<b class="notes">/* ends in */</b>}
abbr[title*=unicorn] {
<b class="notes">/* matches unicorn and unicorns */</b>}
</pre>
<pre contenteditable style="float:left; width: 40%; margin-top:0;">E:[att] <b class="notes"><br/>/* have the attribute at all */</b>
E:[att=val] <b class="notes"><br/>/* exact */</b>
E:[att~=val] <b class="notes"><br/>/* val is a space separated word */</b>
E:[att|=val] <b class="notes"><br/>/* with a dash */</b>
E:[att^=val] <b class="notes"><br/>/* begins with val */</b>
E:[att$=val] <b class="notes"><br/>/* ends with val */</b>
E:[att*=val] <b class="notes"><br/>/* val is anywhere as a substring */</b>
.</pre>
<pre contenteditable style="clear:both">
@media print{
abbr[title]:after {
content: "(" attr(title) ")";
}
a[href^=http]:after {
content: "(" attr(href) ")";
}
}</pre>
</section>
</div>
<!-- Using attribute selectors -->
<div class="slide object">
<object data="files/01_attr.html"></object>
<header><h1>Using attribute selectors</h1></header>
<a href="files/01_attr.html" target="play" class="objectlink">Attribute Selectors</a>
<p><strong>Note:</strong> The top line of the example is editable. The CSS will impact the contents on the rest of the page.</p>
</div>
<!-- CSS4: Attribute Selector -->
<div class="slide">
<header>
<h1>Attribute Selectors 4: Case Insensitivity</h1>
</header>
<section class="content">
<pre contenteditable>E[foo="bar" i]</pre>
<pre contenteditable class="example">input[type=checkbox i]</pre>
<a href="http://codepen.io/estelle/pen/lEGev" target="_play">Test page</a>
</section>
</div>
<!-- UI pseudo-classes -->
<div class="slide normal">
<header><h1>UI pseudo-classes</h1></header>
<section class="content">
<p>Based on current state of UI </p>
<pre contenteditable>
:enabled
:disabled
:checked
:indeterminate (Level 4)</pre>
<pre contenteditable class="example">input[type=checkbox]:checked + label {
color: red;
}</pre>
<div style="clear:both;">
<input type="checkbox" id="test1ck"/> <label for="test1ck">Check and Uncheck Me</label><br/>
<input type="checkbox" id="test2ck"/> <label for="test2ck">Check and uncheck me too!</label></div> </section>
<footer>Basic User Interface Module Level 3 (CSS3 UI)</footer></div>
<!--Form related UI pseudo-classes -->
<div class="slide normal">
<header><h1>Form related UI pseudo-classes</h1></header>
<section class="content">
<pre contenteditable style="font-size: 1.8rem; line-height: 1.4;">:valid
:invalid
:required
:optional
:in-range
:out-of-range
:read-only
:read-write
:default</pre>
</section>
</div>
<!--Form related UI pseudo-classes -->
<div class="slide normal">
<header><h1>Form related UI pseudo-classes</h1></header>
<section class="content">
<pre contenteditable class="example">input:valid { border: 1px solid green;}
input:invalid { border: 1px solid red;}
input:required,
input[aria-required="true"] {border-width: 5px;}
input:optional {border-width: 10px;}
input:out-of-range { background-color: pink;}
input:in-range { background-color:lightgreen;}</pre>
<div style="clear:both;">
<input type="number" min="5" max="7" id="test3ck" required/> <label for="test3ck">Number between 5 and 7</label><br>
<input type="number" min="0" step="0.1" max="10" id="test4ck"/><label for="test4ck">Number between 0 and 10</label>
<pre contenteditable class="example"><input type="number" min="5" max="7"
required aria-required="true"/>
<input type="number" min="0" step="0.1" max="10"/>
</pre>
</div> </section>
</div>
<!-- UI selectors -->
<div class="slide object">
<object data="files/02_uiselectors.html"></object>
<header><h1>UI selectors</h1></header>
<a href="files/02_uiselectors.html" target="play">UI Selectors</a></h1>
<p>Test them out for yourselves</p>
<a class="objectlink" href="files/02_uiselectors.html">Open in new page</a>
</div>
<!-- List of Structural selectors -->
<div class="slide normal">
<header><h1>Structural selectors</h1></header>
<section class="content">
<pre contenteditable class="columns2">:nth-child()
:nth-last-child()
:nth-of-type()
:nth-last-of-type()
:first-child<sup style="color:#C61800">*</sup>
:last-child
:first-of-type
:last-of-type
:only-child
:only-of-type
:root
:empty
:not(:empty)
</pre>
<ul><li>Target elements on the page based on their relationships to other elements in the DOM.</li>
<li>Updates dynamically if page updates.</li>
<li>Reduced need for extra markup, classes and IDs</li>
</ul>
<small style="position:absolute; bottom: 10px; right: 10px;"><sup style="color:#C61800">*</sup> CSS2 / IE8 </small>
</section>
</div>
<!--First, last, & only -->
<div class="slide normal">
<header><h1>First, last, & only</h1></header>
<section class="content">
<pre contenteditable>
:first-child
:last-child
:first-of-type
:last-of-type
:only-child
:only-of-type
</pre>
<p>Easier to explain <a href="files/04_firstlastonly.html" target="play">by example</a></p>
</section>
</div>
<div class="slide object">
<object data="files/04_firstlastonly.html"></object><header><h1>First, last, & only</h1></header>
<a href="files/04_firstlastonly.html" class="objectlink" target="play">First, last and only</a>
</div>
<!--nth pseudo-classes -->
<div class="slide normal">
<header><h1>nth pseudo-classes</h1></header>
<section class="content">
<pre contenteditable class="example">:nth-child(<b>3n</b>)
:nth-last-child(<b>odd</b>)
:nth-of-type(<b>5</b>)
:nth-last-of-type(<b>3n+1</b>) </pre>
<p>Target element or elements based on argument passed to the selector</p>
<ul class="pre">
<li>:nth-of-type(<b>even</b>)</li>
<li>:nth-of-type(<b>odd</b>)</li>
<li>:nth-of-type(<b>an+b</b>) </li>
</ul>
</section>
</div>
<!--Structural Selectors -->
<div class="slide normal">
<header><h1>Structural Selectors</h1></header>
<section class="content">
<pre contenteditable style="margin-top: 0; float: left;">
li:<b>first-child</b>,
li:<b>last-child</b> {
font-weight: bold;
}
li:<b>first-of-type</b>,
li:<b>last-of-type</b>{
text-decoration:line-through;
}
li:<b>nth-child</b>(<b>even</b>) {
background-color: #CCC;
}
li:nth-child(<b>3</b>) {
color: #CCC;
}
li:<b>nth-of-type</b>(<b>odd</b>) {
background-color: #FFF;
}
li:nth-of-type(<b>4n</b>) {
color: hsl(205, 87%, 50%);
}
li:nth-of-type(<b>3n-1</b>) {
text-align: right;
}
</pre>
<ul class="structural" style="float: right; width:33%;">
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
<li>item 5</li>
<li>item 6</li>
<li>item 7</li>
<li>item 8</li>
<li>item 9</li>
<li>item 10</li>
</ul>
</section>
</div>
<!--Advanced Structural Selectors -->
<div class="slide normal">
<header><h1>Structural Selectors</h1></header>
<section class="content">
<ul class="count"><li>1</li></ul>
<ul class="count"><li>1</li><li>2</li></ul>
<ul class="count"><li>1</li><li>2</li><li>3</li></ul>
<ul class="count"><li>1</li><li>2</li><li>3</li><li>4</li></ul>
<pre contenteditable class="example"> li:only-of-type{width: 100%;}
li:nth-of-type(1):nth-last-of-type(2),
li:nth-of-type(2):nth-last-of-type(1){width: 50%;}
li:nth-of-type(1):nth-last-of-type(3),
li:nth-of-type(3):nth-last-of-type(1),
li:nth-of-type(2):nth-last-of-type(2){width: 33.33%;}
li:nth-of-type(1):nth-last-of-type(4),
li:nth-of-type(2):nth-last-of-type(3),
li:nth-of-type(3):nth-last-of-type(2),
li:nth-of-type(4):nth-last-of-type(1){width: 25%;}</pre>
</section>
</div>
<div class="slide object">
<object data="files/05_nth.html"></object>
<header><h1>Structural Selectors</h1></header>
<a href="files/05_nth.html" target="play" class="objectlink">Structural Selectors</a>
</div>
<div class="slide object">
<object data="files/05_flag.html#flag"></object>
<header><h1>Flag with Structural Selectors</h1></header>
<a href="files/05_flag.html" target="play" class="objectlink">USA Flag</a>
</div>
<div class="slide object">
<object data="files/05_flag2.html#flag"></object>
<header><h1>Simpler Flag with Structural Selectors</h1></header>
<a href="files/05_flag2.html" target="play" class="objectlink">USA Flag</a>
</div>
<div class="slide">
<header><h1>Structural Selectors Level 4</h1></header>
<section class="content double">
<pre contenteditable>E:nth-match(n of selector)
E:nth-last-match(n of selector)</pre>
<pre contenteditable class="example">li:nth-match(2n of .foo)
li:nth-last-match(3n+1 of .bar)</pre>
</section>
</div>
<!-- :not -->
<div class="slide normal">
<header><h1><strong>:not</strong> - Negation pseudo-class</h1></header>
<section class="content">
<pre contenteditable>E<b contenteditable="false">:not(</b>s1<b contenteditable="false">)</b></pre>
<pre contenteditable class=" example">div<b contenteditable="false">:not(</b>.excludeMe<b contenteditable="false">)</b></span></pre>
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable>E:not(s1, s2)</pre>
<pre class="example" contenteditable>li<b contenteditable="false">:not(</b>.foo<b contenteditable="false">,</b> .bar<b contenteditable="false">)</b></pre>
<pre contenteditable>E:matches(s1, s2)</pre>
<pre class="example" contenteditable>li<b contenteditable="false">:matches(</b>[title]<b contenteditable="false">,</b> [role]<b contenteditable="false">)</b></pre>
</pre>
</section>
</div>
<div class="slide">
<header><h1>Experimental :any</h1></header>
<section class="content">
<pre contenteditable>E:matches(s1, s2)</pre>
<pre contenteditable class="example" >:-webkit-any(article, aside) :-webkit-any(article, aside) h1,
:-moz-any(article, aside) :-moz-any(article, aside) h1 {
}</pre><pre contenteditable class="example" >
nav a:matches(.foo, .bar, .bam),
nav a:-webkit-any(.foo, .bar, .bam),
nav a:-moz-any(.foo, .bar, .bam) {
}</pre><pre contenteditable class="example" >
nav a:not(:matches(.foo, .bar, .bam)),
nav a:not(:-webkit-any(.foo, .bar, .bam)),
nav a:not(:-moz-any(.foo, .bar, .bam)),
nav a:not(.foo, .bar, .bam) {
}
</pre>
</section>
</div>
<!--
<div class="slide object">
<object data="files/06_not.html"></object>
<header><h1><strong>:not</strong> - Negation pseudo-class</h1></header>
<a href="files/06_not.html" target="play" class="objectlink">Negation Selectors</a>
</div>
-->
<!-- :empty pseudo-class -->
<div class="slide normal">
<header><h1>:empty pseudo-class </h1></header>
<section class="content">
<pre contenteditable>E<b>:empty</b></pre>
<pre contenteditable class="example">p<b>:empty</b></pre>
<p>Matches:
<pre contenteditable><p></p>
<p><!-- this is a comment --></p>
</pre>
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable>E<b>:blank</b></pre>
<pre contenteditable class="example">p<b>:blank</b></pre>
<p>Also matches:
<pre contenteditable><p> </p></pre>
</section>
</div>
<!-- links-->
<div class="slide normal">
<header><h1>Link Pseudo Classes</h1></header>
<section class="content">
<pre contenteditable class="double">:link
:visited</pre>
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable class="double">:any-link
:local-link
:local-link(n)</pre>
</section>
</div>
<div class="slide">
<header><h1>link levels</h1></header>
<section class="content">
<pre contenteditable class="example">:local-link {
text-decoration: none;
color: inherit;
}</pre>
<pre contenteditable class="example"><s>a[href^=http],</s>
a[href^="http://"],
a[href^="https://"],
a:not(:local-link(0)){
/* external link */
}
</section>
</div>
<!-- lang, target, anchor links-->
<div class="slide normal">
<header><h1>User Action Pseudo Classes</h1></header>
<section class="content">
<pre contenteditable class="double">:hover
:active
:focus</pre>
</section>
</div>
<!-- lang, target, anchor links-->
<div class="slide normal">
<header><h1>Drag and Drop Pseudo Classes</h1></header>
<section class="content">
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable class="double">:active-drop
:valid-drop
:invalid-drop</p>
</section>
</div>
<!-- lang, target, anchor links-->
<div class="slide normal">
<header><h1>Other Pseudo Classes</h1></header>
<section class="content">
<pre contenteditable class="double">
:target</pre>
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable class="double">:scope</pre>
</section>
</div>
<div class="object slide">
<object data="files/07_target.html"></object>
<header><h1>:target pseudo-class</h1></header>
<a href="files/07_target.html" target="play" class="objectlink">:target example</a>
</div>
<!-- lang, target, anchor links-->
<div class="slide normal">
<header><h1>Language Pseudo Classes</h1></header>
<section class="content">
<pre contenteditable class="double">:lang(en)</pre>
<p class="css4 temphidden">CSS Selectors Level 4</p>
<pre contenteditable class="double">:lang(zh, *-hant)
:dir(ltr|rtl)</pre>
</section>
</div>
<!--root -->
<div class="slide normal">
<header><h1>:root</h1></header>
<section class="content">
<pre contenteditable>
:root
</pre>
<p>Selects the document root, which is <html></p>
<ul><li>Declare <em>font-size</em> on <strong>:root</strong> if using <strong>rem</strong> units</li>
<li>Style <strong>:root</strong> only if showing <strong><head></strong> (as in our exercise files)</li>
<li>In CSS4, define Defining Variables on root. (see <a href="http://dev.w3.org/csswg/css-variables/" target="play">Variables module</a>)</li>
</ul>
<p><small><a href="files/03_root.html" target="play">example</a></small></p>
</section>
</div>
<div class="slide object">
<div style="background-image: url(http://www.standardista.com/wp-content/uploads/2012/01/specifishity.gif); background-size: cover; position:absolute; height: 792px; overflow: scroll; top: 0; left: 0; width: 100%"></div>
<header><h1>Specificity (SpeciFISHity)</h1></header>
<a href="http://www.standardista.com/wp-content/uploads/2012/01/specifishity1.pdf" target="play" class="objectlink">Download</a>
</div>
<div class="object slide">
<object data="http://www.standardista.com/wp-content/uploads/2012/01/specifishity1.pdf" style="height: 792px;"></object>
<header><h1>Specificity (SpeciFISHity)</h1></header>
<a href="http://www.standardista.com/wp-content/uploads/2012/01/specifishity1.pdf" target="play" class="objectlink"> </a>
</div>
<!-- Specificity Notes -->
<div class="slide normal">
<header><h1>Specificity: The less than obvious</h1></header>
<section class="content">
<p>The * selector, or global selector, has no value.</p>
<pre contenteditable>* {} 0-0-0 </pre>
<p>Combinators, like ~, >, and + have no value</p>
<pre contenteditable>ul li {} 0-0-2
ul > li {} 0-0-2</pre>
<p>:not has no value, but parameter selector does</p>
<pre contenteditable>.myClass:not(p) {} 0-1-1</pre>
<p>Specificity is not inheritance</p>
</section>
</div>
<!-- Pseudo elements -->
<div class="slide intro">
<header><h1>Pseudo elements</h1></header>
</div>
<!-- Pseudo elements -->
<div class="slide normal thisSlide">
<header><h1>Pseudo elements</h1></header>
<section class="content">
<pre contenteditable style="font-size: 100%;">
::first-line
::first-letter
::selection (not in specification)
::before
::after
</pre>
<p><i class="imp">Pseudo-classes</i> select elements that
already exist.<br>
<i class="imp">Pseudo-elements</i> create "faux" elements you can style.</p>
<p> Use single colon because of IE</p>
</section>
</div>
<!-- Drop Cap -->
<div class="slide object ">
<header><h1>::first-letter</h1></header>
<object data="files/08_dropcap.html">
<section class="content">
<p class="firstletter">You can even pretty drop-caps with :first-letter, but make sure to apply it to p:first-of-type so your site not too ugly. <a href="files/08_dropcap.html" target="play" class="objectlink">Code for drop cap.</a></p> <pre contenteditable>p:first-of-type::first-letter {
position: relative;
top: 8px;
float: left;
font-size: 3em;
line-height: 1;
color: hsl(205, 87%, 50%);
padding: 0 4px 2px 0;
font-weight: bold;
}
</pre>
</section>
</object>
<a href="files/08_dropcap.html" target="play" class="objectlink">Drop Cap</a>
</div>
<!-- ::selection -->
<div class="slide normal thisSlide">
<header><h1>::selection</h1></header>
<section class="content">
<pre contenteditable>.thisSlide *::selection {