├── LICENSE ├── README ├── css ├── page-bg.jpg ├── prefixfree.js ├── print.css ├── religion.css ├── screen.css └── slide.js ├── files ├── 00_basic.html ├── 01_attr.html ├── 02_uiselectors.html ├── 03_root.html ├── 04_firstlastonly.html ├── 05_nth.html ├── 06_not.html ├── 07_target.html ├── 08_dropcap.html ├── 100_simpletransforms.html ├── 101_transform3dhtml.html ├── 101_transformorigin.html ├── 102_backface.html ├── 11_specificity.html ├── 12_flexbox.html ├── 31_generatetext.html ├── 32_generatetext.html ├── 32b_generatetext.html ├── 33_bubbles.html ├── 34_bubbles.html ├── 35_tooltip.html ├── 40_supports.html ├── 72_boxshadow.html ├── 72a_boxshadow.html ├── 80_bgposition.html ├── 81_bgposition.html ├── 81b_bgposition.html ├── 82_borderradius.html ├── 83_longcat.html ├── 91_basic.html ├── 92_basic.html └── 92_different_angles.html ├── icons ├── browser_logos-64.png ├── new.gif └── oreilly.gif ├── img ├── fish.png ├── googlefonts.gif ├── plankton.png └── shark.gif ├── index.html ├── part_01_selectors.html ├── part_02_specificity.html ├── part_03_generated.html ├── part_04_media.html ├── part_06_colors.html ├── part_07_fonts.html ├── part_08_backgrounds.html ├── part_09_gradients.html ├── part_10_transforms.html ├── part_11_animations.html ├── part_12_features.html └── slides.js /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/README -------------------------------------------------------------------------------- /css/page-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/css/page-bg.jpg -------------------------------------------------------------------------------- /css/prefixfree.js: -------------------------------------------------------------------------------- 1 | /** 2 | * StyleFix 1.0.1 3 | * @author Lea Verou 4 | * MIT license 5 | */ 6 | 7 | (function(){ 8 | 9 | if(!window.addEventListener) { 10 | return; 11 | } 12 | 13 | var self = window.StyleFix = { 14 | link: function(link) { 15 | try { 16 | // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets 17 | if(link.rel !== 'stylesheet' || !link.sheet.cssRules || link.hasAttribute('data-noprefix')) { 18 | return; 19 | } 20 | } 21 | catch(e) { 22 | return; 23 | } 24 | 25 | var url = link.href || link.getAttribute('data-href'), 26 | base = url.replace(/[^\/]+$/, ''), 27 | parent = link.parentNode, 28 | xhr = new XMLHttpRequest(); 29 | 30 | xhr.open('GET', url); 31 | 32 | xhr.onreadystatechange = function() { 33 | if(xhr.readyState === 4) { 34 | var css = xhr.responseText; 35 | 36 | if(css && link.parentNode) { 37 | css = self.fix(css, true, link); 38 | 39 | // Convert relative URLs to absolute, if needed 40 | if(base) { 41 | css = css.replace(/url\((?:'|")?(.+?)(?:'|")?\)/gi, function($0, url) { 42 | if(!/^([a-z]{3,10}:|\/|#)/i.test(url)) { // If url not absolute & not a hash 43 | // May contain sequences like /../ and /./ but those DO work 44 | return 'url("' + base + url + '")'; 45 | } 46 | 47 | return $0; 48 | }); 49 | 50 | // behavior URLs shoudn’t be converted (Issue #19) 51 | css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1'); 52 | } 53 | 54 | var style = document.createElement('style'); 55 | style.textContent = css; 56 | style.media = link.media; 57 | style.disabled = link.disabled; 58 | style.setAttribute('data-href', link.getAttribute('href')); 59 | 60 | parent.insertBefore(style, link); 61 | parent.removeChild(link); 62 | } 63 | } 64 | }; 65 | 66 | xhr.send(null); 67 | 68 | link.setAttribute('data-inprogress', ''); 69 | }, 70 | 71 | styleElement: function(style) { 72 | var disabled = style.disabled; 73 | 74 | style.textContent = self.fix(style.textContent, true, style); 75 | 76 | style.disabled = disabled; 77 | }, 78 | 79 | styleAttribute: function(element) { 80 | var css = element.getAttribute('style'); 81 | 82 | css = self.fix(css, false, element); 83 | 84 | element.setAttribute('style', css); 85 | }, 86 | 87 | process: function() { 88 | // Linked stylesheets 89 | $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); 90 | 91 | // Inline stylesheets 92 | $('style').forEach(StyleFix.styleElement); 93 | 94 | // Inline styles 95 | $('[style]').forEach(StyleFix.styleAttribute); 96 | }, 97 | 98 | register: function(fixer, index) { 99 | (self.fixers = self.fixers || []) 100 | .splice(index === undefined? self.fixers.length : index, 0, fixer); 101 | }, 102 | 103 | fix: function(css, raw) { 104 | for(var i=0; i 3) { 221 | parts.pop(); 222 | 223 | var shorthand = parts.join('-'); 224 | 225 | if(supported(shorthand) && properties.indexOf(shorthand) === -1) { 226 | properties.push(shorthand); 227 | } 228 | } 229 | } 230 | }, 231 | supported = function(property) { 232 | return StyleFix.camelCase(property) in dummy; 233 | } 234 | 235 | // Some browsers have numerical indices for the properties, some don't 236 | if(style.length > 0) { 237 | for(var i=0; i .counter, 159 | .slide.segue > .counter, 160 | .slide.mainTitle > .counter { 161 | display: none; 162 | } 163 | 164 | .force-render { 165 | display: block; 166 | visibility: hidden; 167 | } 168 | .slide, 169 | .slide.far-past { 170 | display: block; 171 | margin-left: -2400px; 172 | } 173 | 174 | .slide.past { 175 | visibility: visible; 176 | display: block; 177 | margin-left: -1400px; 178 | } 179 | 180 | .slide.current { 181 | visibility: visible; 182 | display: block; 183 | margin-left: -450px; 184 | } 185 | 186 | .slide.future { 187 | visibility: visible; 188 | display: block; 189 | margin-left: 500px; 190 | } 191 | 192 | .slide.far-future { 193 | display: block; 194 | margin-left: 1500px; 195 | } 196 | 197 | body.three-d div.slides { 198 | -webkit-transform: translateX(50px) scale(0.8) rotateY(10deg); 199 | -moz-transform: translateX(50px) scale(0.8) rotateY(10deg); 200 | -o-transform: translateX(50px) scale(0.8) rotateY(10deg); 201 | transform: translateX(50px) scale(0.8) rotateY(10deg); 202 | } 203 | 204 | /* ############################ 205 | 206 | BROWSER SUPPORT & ICONS 207 | 208 | ############################ */ 209 | 210 | 211 | 212 | .icons li, .icons .browser { 213 | width: 68px; height: 14px; display: inline-block; 214 | background-image:url(../icons/browser_logos-64.png); 215 | border-radius: 32px; 216 | font-size: 0.8rem; 217 | padding-top: 60px; 218 | text-align:center; 219 | position: relative; 220 | background-repeat: no-repeat; 221 | } 222 | .icons .firefox {background-position:-80px 0} 223 | .icons .ie {background-position:-280px 0} 224 | .icons .safari {background-position:-210px 0} 225 | .icons .chrome {background-position:0 0 } 226 | .icons .opera {background-position:-140px 0} 227 | .icons .new:after { 228 | content: ""; 229 | width: 40px; 230 | height: 28px; 231 | display:block; 232 | position:absolute; 233 | top: -8px; 234 | right:-10px; 235 | background-image:url(../icons/new.gif); 236 | } 237 | .icons .no {opacity: 0.25;} 238 | .icons .bad, 239 | .icons .iffy {opacity: 0.60;} 240 | .icons .bad { 241 | margin-right: 10px; 242 | margin-left: 10px; 243 | } 244 | .icons .bad:after { 245 | position:absolute; 246 | top: -10px; 247 | left:-15px; 248 | content: ""; 249 | -webkit-box-sizing: padding-box; 250 | background: 251 | -webkit-linear-gradient(135deg, 252 | transparent 45%, 253 | red 45%, 254 | red 55%, 255 | transparent 55%); 256 | width: 68px; 257 | height: 68px; 258 | border-radius: 50%; 259 | border: 10px solid red; 260 | display:block; 261 | } 262 | 263 | .icons .half:after { 264 | position:absolute; 265 | top: 0; 266 | right:0; 267 | content: ""; 268 | background-color: #DCe7f3; 269 | width: 33px; 270 | border-radius: 0 0 50% 0; 271 | height: 65px; 272 | display:block; 273 | } 274 | .icons .half.new:after { 275 | background-repeat: no-repeat; 276 | background-color:transparent; 277 | background-image:url(../icons/new.gif), 278 | -webkit-linear-gradient(0deg, transparent 30%, #DCe7f3 30%) ; 279 | background-image:url(../icons/new.gif), 280 | -moz-linear-gradient(0deg, transparent 30%, #DCe7f3 30%) ; 281 | background-image:url(../icons/new.gif), 282 | -ms-linear-gradient(0deg, transparent 30%, #DCe7f3 30%) ; 283 | background-image:url(../icons/new.gif), 284 | -o-linear-gradient(0deg, transparent 30%, #DCe7f3 30%) ; 285 | background-image:url(../icons/new.gif), 286 | linear-gradient(0deg, transparent 30%, #DCe7f3 30%) ; 287 | width: 40px; 288 | 289 | } 290 | .icons .txt {background-image: none; width: auto; font-size: 1.5rem;} 291 | 292 | 293 | /* Content */ 294 | header { 295 | font-weight: normal; 296 | letter-spacing: -.05em; 297 | text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px; 298 | left: 30px; 299 | top: 25px; 300 | font-size: 1.4rem; 301 | } 302 | 303 | h1 { 304 | font-size: 1.4rem; 305 | margin-bottom: 0; 306 | color: #C7573A; 307 | text-align:center; 308 | } 309 | 310 | h2 { 311 | font-size: .9rem; 312 | } 313 | 314 | h1:first-child { 315 | margin-top: 0; 316 | } 317 | 318 | section, footer { 319 | text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px; 320 | margin: 20px 30px 0; 321 | display: block; 322 | overflow: hidden; 323 | } 324 | 325 | footer { 326 | font-size: 1rem; 327 | margin: 20px 0 0 30px; 328 | } 329 | 330 | a { 331 | color: #C7573A; 332 | display: inline-block; 333 | text-decoration: none; 334 | line-height: 110%; 335 | border-bottom: 2px dotted #BDD9D5; 336 | } 337 | 338 | pre, .ex, .pre, .codelike { 339 | text-align: left; 340 | padding: 10px 20px; 341 | background: rgba(255, 255, 255, 0.6); 342 | -moz-border-radius: 8px; 343 | border-radius: 8px; 344 | border: 1px solid #fff; 345 | font-size: 1.8rem; 346 | line-height: 1.8rem; 347 | } 348 | .ex.right { 349 | float: right; 350 | width: 200px; 351 | } 352 | .pre li{ 353 | font-family: monospace; 354 | font-size: 1.3rem; 355 | list-style-type: none; 356 | } 357 | .preintro pre { 358 | font-size: 1.7rem; 359 | margin: 30px 20px 0 0; 360 | line-height: 1.5; 361 | } 362 | 363 | pre b, .pre b, .imp { 364 | font-weight: normal; 365 | color: #C7573A; 366 | text-shadow: #c61800 0 0 1px; 367 | /*letter-spacing: -1px;*/ 368 | } 369 | 370 | pre em { 371 | font-weight: normal; 372 | font-style: normal; 373 | color: #C7573A; 374 | text-shadow: rgba(0,0,0,0.3) 1px 1px 2px; 375 | font-weight: bold; 376 | } 377 | 378 | div.example { 379 | display: block; 380 | padding: 10px 20px; 381 | background: rgba(255, 255, 255, 0.4); 382 | margin-bottom: 10px; 383 | border: 1px solid rgba(0, 0, 0, 0.2); 384 | } 385 | 386 | #presentation-counter { 387 | color: #ccc; 388 | font-size: 0.7rem; 389 | letter-spacing: 1px; 390 | position: absolute; 391 | top: 40%; 392 | left: 0; 393 | width: 100%; 394 | text-align: center; 395 | } 396 | 397 | div:not(.current).reduced { 398 | -webkit-transform: scale(0.8); 399 | -moz-transform: scale(0.8); 400 | -o-transform: scale(0.8); 401 | transform: scale(0.8); 402 | } 403 | 404 | .no-transitions { 405 | -webkit-transition: none; 406 | -moz-transition: none; 407 | -o-transition: none; 408 | transition: none; 409 | } 410 | 411 | .no-gradients { 412 | background: none; 413 | background-color: #fff; 414 | } 415 | dt { 416 | font-weight: bold; 417 | margin-top: 0.5rem; 418 | 419 | background-color: #BDD9D5;; 420 | display:inline-block; 421 | margin-bottom: 2px; 422 | clear: both; 423 | } 424 | dd { 425 | font-weight: normal; 426 | margin: 0 0 2px 0; 427 | } 428 | 429 | dl.inline dt { 430 | width: 200px; 431 | float: left; 432 | text-align: right; 433 | padding-right: 15px; 434 | clear:both; 435 | margin: 0 0 2px 0; 436 | } 437 | dl.inline dd{ 438 | font-style: italic; 439 | } 440 | .light section { 441 | font-size: 1.8rem; 442 | } 443 | 444 | .new {color: #C7573A; background-color: #fff; padding: 3px 8px;} 445 | ul.columns { 446 | -webkit-column-count: 4; 447 | margin: 40px -40px 0; 448 | } 449 | ul { 450 | -moz-box-sizing: border-box; 451 | box-sizing: border-box; 452 | } 453 | .play h1 { 454 | text-align:center; 455 | margin-top:100px; 456 | font-size: 2rem; 457 | 458 | } 459 | .play {text-align: center;} 460 | .columns2 { 461 | -webkit-columns: 2 1rem; 462 | 463 | -webkit-column-rule: 1px solid #BDD9D5; 464 | } 465 | 466 | .hilite {font-size: 1.2rem; padding:5px 2px;} 467 | 468 | .specificity li{ 469 | display: inline-block; 470 | width: 200px; 471 | padding-bottom: 180px; 472 | background-position: 50% bottom; 473 | text-align:center; 474 | font-size: 1.5rem; 475 | 476 | border-radius: 15px; 477 | background-color: #fff; 478 | margin: 0 30px; 479 | } 480 | .nonspec li {padding-bottom: 0;} 481 | .specificity .id { 482 | background-image:url(../img/shark.gif); 483 | } 484 | .specificity .class { 485 | background-image:url(../img/fish.png); 486 | } 487 | .specificity .element { 488 | background-image:url(../img/plankton.png); 489 | } 490 | .object header {position:absolute; top: 10px; width: 100%; text-align:center; background-color: rgba(255,255,255,0.9); left:0;} 491 | .objectlink {position:absolute;top:0; right:0;color: white; background-color: #C7573A; padding: 3px 5px; border: none;} 492 | .slide.object {padding:0;} 493 | .object object {width: 100%; height: 100%;} 494 | 495 | .deprecated dt {margin-bottom: 1rem; 496 | } 497 | .deprecated dd {display: none;} 498 | .deprecated dt:hover + dd {display:inherit;} 499 | .appearance dt {margin-bottom:0.5rem; 500 | } 501 | .deprecated.listed dt {margin-bottom:0; margin-top:0.2rem; 502 | display:block; width: 50%; padding-left: 5px; 503 | } 504 | .deprecated.listed.wide dt{width:100%;} 505 | 506 | button, .button { 507 | -webkit-appearance: none; 508 | color: #333; 509 | font-size: 1.6rem; 510 | text-shadow: 1px 1px 1px rgba(0,0,0,0.2); 511 | background: -webkit-linear-gradient(#fff, #ddd); 512 | border-radius: 15px; 513 | border: none; 514 | padding: 5px 10px; 515 | box-shadow: 2px 2px 2px rgba(0,0,0,0.2); 516 | } 517 | button:hover { 518 | background: -webkit-linear-gradient(#ddd, #fff); 519 | } 520 | .slide.object section {margin-top:100px;} 521 | td {text-align:center;} 522 | [contenteditable]:focus {outline: 1px dashed #fff;} 523 | section > ol {-webkit-margin-start: 2rem; 524 | } 525 | 526 | 527 | /* ======================= 528 | 529 | SLIDE ORIGINAL 530 | 531 | ========================== */ 532 | body { 533 | font-family:"Trebuchet MS", Arial, Helvetica, sans-serif, 'Droid Sans'; 534 | padding: 0; 535 | margin: 0; 536 | width: 100%; 537 | height: 100%; 538 | position: absolute; 539 | left: 0px; top: 0px; 540 | } 541 | 542 | #info { 543 | font-size: small; 544 | position: absolute; 545 | bottom: 0px; 546 | left: 40%; 547 | z-index: 500; 548 | color: #fff; 549 | } 550 | /* optional */ 551 | #topinfo { 552 | font-size: small; 553 | position: absolute; 554 | top: 5px; 555 | right: 5px; 556 | z-index: 500; 557 | } 558 | .key { 559 | color: black; 560 | display: inline-block; 561 | padding: 3px 3px 3px 3px; 562 | text-shadow: none; 563 | letter-spacing: 0; 564 | position: relative; 565 | background: white; 566 | border-radius: 5px; 567 | font-weight: bold; 568 | text-shadow: 0 0 1px currentColor; 569 | } 570 | 571 | .slides { 572 | padding-top: 10px; 573 | padding-bottom: 10px; 574 | width: 100%; 575 | height: 100%; 576 | left: 0; 577 | top: 0; 578 | position: absolute; 579 | display: block; 580 | -webkit-transition: -webkit-transform 1s ease-in-out; 581 | -moz-transition: -moz-transform 1s ease-in-out; 582 | -ms-transition: -ms-transform 1s ease-in-out; 583 | -o-transition: -o-transform 1s ease-in-out; 584 | transition: transform 1s ease-in-out; 585 | -webkit-transform: scale(0.8); 586 | -moz-transform: scale(0.8); 587 | -ms-transform: scale(0.8); 588 | -o-transform: scale(0.8); 589 | transform: scale(0.8); 590 | } 591 | .slide { 592 | display: none; 593 | position: absolute; 594 | overflow: hidden; 595 | width: 900px; 596 | height: 700px; 597 | left: 50%; 598 | top: 50%; 599 | margin-top: -350px; 600 | background-color: #eee; 601 | -webkit-transition: all 0.25s ease-in-out; 602 | -moz-transition: all 0.25s ease-in-out; 603 | -ms-transition: all 0.25s ease-in-out; 604 | -o-transition: all 0.25s ease-in-out; 605 | transition: all 0.25s ease-in-out; 606 | -webkit-transform: scale(1); 607 | -moz-transform: scale(1); 608 | -ms-transform: scale(1); 609 | -o-transform: scale(1); 610 | transform: scale(1); 611 | padding-left: 20px; 612 | padding-top: 10px; 613 | border-radius: 15px; 614 | border: 5px solid #fff; 615 | 616 | box-shadow: 0 0 20px rgba(0,0,0,0.6), inset 0 0 6px rgba(0,0,0,0.4); 617 | } 618 | .slide.intro { 619 | text-align: center; 620 | font-size: 2rem; 621 | } 622 | .slide.intro hgroup { 623 | margin-top: 200px; 624 | } 625 | .content { 626 | font-size: 2rem; 627 | } 628 | .content input, button { 629 | font-size: 2rem; 630 | } 631 | .slide textarea.mynotes { 632 | -webkit-appearance: none; 633 | border: 1px #aaa solid; 634 | border-radius: 5px; 635 | width: 100%; 636 | font-size: 1.2rem; 637 | font-style: italic; 638 | box-shadow: inset 0 0 8px rgba(0,0,0,0.3); 639 | padding: 5px; 640 | box-sizing: border-box; 641 | font-family:"Palatino Linotype", "Book Antiqua", Palatino, cursive,serif; 642 | } 643 | .content td { 644 | border: 1px solid black; 645 | } 646 | .invalid { 647 | background-color: red; 648 | } 649 | .slide.section,.slide.intro { 650 | text-align: center; 651 | } 652 | .slide.section,.slide.intro header { 653 | font-size: 2.5rem; 654 | } 655 | .slide li { 656 | margin-bottom: 10px; 657 | } 658 | .slide img { 659 | max-height: 90%; 660 | border: 1px solid white; 661 | -moz-box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px; 662 | box-shadow: rgba(0, 0, 0, 0.1) 0 2px 5px; 663 | text-align: center; 664 | } 665 | .slide p{ 666 | font-size: 2rem; 667 | } 668 | .slide .counter { 669 | color: #999999; 670 | position: absolute; 671 | left: 20px; 672 | bottom: 20px; 673 | display: block; 674 | font-size: 0.9rem; 675 | } 676 | .slide.title > .counter, 677 | .slide.segue > .counter, 678 | .slide.mainTitle > .counter { 679 | display: none; 680 | } 681 | .force-render { 682 | display: block; 683 | visibility: hidden; 684 | } 685 | .slide.far-past { 686 | display: block; 687 | margin-left: -2400px; 688 | } 689 | .slide.past { 690 | visibility: visible; 691 | display: block; 692 | margin-left: -1400px; 693 | } 694 | .slide.current { 695 | visibility: visible; 696 | display: block; 697 | margin-left: -450px; 698 | } 699 | .slide.future { 700 | visibility: visible; 701 | display: block; 702 | margin-left: 500px; 703 | } 704 | .slide.far-future { 705 | display: block; 706 | margin-left: 1500px; 707 | } 708 | 709 | /* Content */ 710 | 711 | header { 712 | font-weight: normal; 713 | letter-spacing: -.05rem; 714 | text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px; 715 | left: 30px; 716 | top: 25px; 717 | font-size: 2rem; 718 | } 719 | h1 { 720 | font-size: 2.5rem; 721 | margin-bottom: 0; 722 | } 723 | h2 { 724 | font-size: 1.9rem; 725 | } 726 | h1:first-child { 727 | margin-top: 0; 728 | } 729 | section, footer { 730 | text-shadow: rgba(0, 0, 0, 0.2) 0 2px 5px; 731 | margin: 20px 30px 0; 732 | display: block; 733 | overflow: hidden; 734 | } 735 | footer { 736 | font-size: 1rem; 737 | margin: 20px 0 0 30px; 738 | } 739 | a { 740 | display: inline-block; 741 | text-decoration: none; 742 | line-height: 110%; 743 | } 744 | a:hover { 745 | text-decoration: underline; 746 | } 747 | 748 | div.example { 749 | display: block; 750 | padding: 10px 20px; 751 | background: rgba(255, 255, 255, 0.4); 752 | border-radius: 8px; 753 | margin-bottom: 10px; 754 | border: 1px solid rgba(0, 0, 0, 0.2); 755 | } 756 | #presentation-counter { 757 | color: #ccc; 758 | font-size: 0.9rem; 759 | letter-spacing: 1px; 760 | position: absolute; 761 | top: 40%; 762 | left: 0; 763 | width: 100%; 764 | text-align: center; 765 | } 766 | #next, 767 | #back { 768 | z-index: 1000; 769 | position: absolute; 770 | top: 5px; 771 | left: 5px; 772 | list-style-type: none; 773 | -webkit-appearance: none; 774 | color: #333; 775 | font-size: 1rem; 776 | text-shadow: 1px 1px 1px rgba(0,0,0,0.2); 777 | background: -webkit-linear-gradient(#fff 50%, #eee 50%, #ddd); 778 | background: -moz-linear-gradient(#fff 50%, #eee 50%, #ddd); 779 | background: -ms-linear-gradient(#fff 50%, #eee 50%, #ddd); 780 | background: -o-linear-gradient(#fff 50%, #eee 50%, #ddd); 781 | background: linear-gradient(#fff 50%, #eee 50%, #ddd); 782 | border-radius: 7px; 783 | border: none; 784 | padding: 5px 10px; 785 | letter-spacing:1px; 786 | font-size: 1rem; 787 | box-shadow: inset 0 0 2px rgba(0,0,0,0.3), 788 | 2px 2px 5px rgba(0,0,0,0.7); 789 | border: 3px solid #eee; 790 | } 791 | #next {left: auto; right: 5px;} 792 | 793 | /* OBJECT PAGES */ 794 | .object header { 795 | position:absolute; 796 | top: 10px; 797 | width: 100%; 798 | text-align:center; 799 | background-color: rgba(255,255,255,0.9); 800 | left:0; 801 | } 802 | .objectlink { 803 | position:absolute; 804 | top:0; right:0; 805 | color: white; 806 | background-color: #000; 807 | padding: 3px 5px; 808 | border: none; 809 | } 810 | .slide.object {padding:0;} 811 | .object object {min-height: 100%;} 812 | .notes, .temphidden {display: none;} 813 | 814 | /* =============================== 815 | 816 | PRINT STYLE SHEET 817 | 818 | // =============================== */ 819 | 820 | @media print { 821 | .slide { 822 | page-break-inside: avoid; 823 | page-break-after: always; 824 | visibility: visible !important; 825 | font-size: 20pt; 826 | font-family: Arial, sans-serif; 827 | } 828 | @page { 829 | size: landscape; 830 | } 831 | body { 832 | font-size: 12pt; 833 | background: white; 834 | } 835 | header h1 { 836 | border-top: 2pt solid gray; 837 | border-bottom: 1px dotted silver; 838 | } 839 | #presentation-counter, #info, #topinfo, .counter { 840 | display: none 841 | } 842 | } 843 | -------------------------------------------------------------------------------- /css/slide.js: -------------------------------------------------------------------------------- 1 | // JavaScript Document 2 | 3 | 4 | function vendorPrefix(prefix, id){ 5 | var prefixTxt = 'cat'; 6 | switch (prefix){ 7 | case 'w': 8 | prefixTxt = '-webkit-'; 9 | break; 10 | case 'm': 11 | prefixTxt = '-moz-'; 12 | break; 13 | case 'ms': 14 | prefixTxt = '-ms-'; 15 | break; 16 | case 'o': 17 | prefixTxt = '-o-'; 18 | break; 19 | case 'r': 20 | prefixTxt = ''; 21 | break; 22 | }; 23 | var spans = document.getElementById(id).querySelectorAll('u'); 24 | for(var i = 0, j = spans.length; i < j; i++ ){ 25 | spans[i].innerHTML = prefixTxt; 26 | } 27 | 28 | } 29 | 30 | 31 | 32 | (function() { 33 | var doc = document; 34 | var disableBuilds = true; 35 | 36 | var ctr = 0; 37 | var spaces = /\s+/, a1 = ['']; 38 | 39 | var toArray = function(list) { 40 | return Array.prototype.slice.call(list || [], 0); 41 | }; 42 | 43 | var byId = function(id) { 44 | if (typeof id == 'string') { return doc.getElementById(id); } 45 | return id; 46 | }; 47 | 48 | var query = function(query, root) { 49 | if (!query) { return []; } 50 | if (typeof query != 'string') { return toArray(query); } 51 | if (typeof root == 'string') { 52 | root = byId(root); 53 | if(!root){ return []; } 54 | } 55 | 56 | root = root || document; 57 | var rootIsDoc = (root.nodeType == 9); 58 | var doc = rootIsDoc ? root : (root.ownerDocument || document); 59 | 60 | // rewrite the query to be ID rooted 61 | if (!rootIsDoc || ('>~+'.indexOf(query.charAt(0)) >= 0)) { 62 | root.id = root.id || ('qUnique' + (ctr++)); 63 | query = '#' + root.id + ' ' + query; 64 | } 65 | // don't choke on something like ".yada.yada >" 66 | if ('>~+'.indexOf(query.slice(-1)) >= 0) { query += ' *'; } 67 | 68 | return toArray(doc.querySelectorAll(query)); 69 | }; 70 | 71 | var strToArray = function(s) { 72 | if (typeof s == 'string' || s instanceof String) { 73 | if (s.indexOf(' ') < 0) { 74 | a1[0] = s; 75 | return a1; 76 | } else { 77 | return s.split(spaces); 78 | } 79 | } 80 | return s; 81 | }; 82 | /* 83 | var _notesOn = false; 84 | var showNotes = function() { 85 | var isOn = this._notesOn = !this._notesOn; 86 | document.querySelectorAll('.notes').forEach(function(el) { 87 | el.style.display = (isOn) ? '' : 'none'; 88 | }); 89 | }; 90 | */ 91 | var addClass = function(node, classStr) { 92 | classStr = strToArray(classStr); 93 | var cls = ' ' + node.className + ' '; 94 | for (var i = 0, len = classStr.length, c; i < len; ++i) { 95 | c = classStr[i]; 96 | if (c && cls.indexOf(' ' + c + ' ') < 0) { 97 | cls += c + ' '; 98 | } 99 | } 100 | node.className = cls.trim(); 101 | }; 102 | 103 | var removeClass = function(node, classStr) { 104 | var cls; 105 | if (classStr !== undefined) { 106 | classStr = strToArray(classStr); 107 | cls = ' ' + node.className + ' '; 108 | for (var i = 0, len = classStr.length; i < len; ++i) { 109 | cls = cls.replace(' ' + classStr[i] + ' ', ' '); 110 | } 111 | cls = cls.trim(); 112 | } else { 113 | cls = ''; 114 | } 115 | if (node.className != cls) { 116 | node.className = cls; 117 | } 118 | }; 119 | 120 | var toggleClass = function(node, classStr) { 121 | var cls = ' ' + node.className + ' '; 122 | if (cls.indexOf(' ' + classStr.trim() + ' ') >= 0) { 123 | removeClass(node, classStr); 124 | } else { 125 | addClass(node, classStr); 126 | } 127 | }; 128 | 129 | var ua = navigator.userAgent; 130 | var isFF = parseFloat(ua.split('Firefox/')[1]) || undefined; 131 | var isWK = parseFloat(ua.split('WebKit/')[1]) || undefined; 132 | var isOpera = parseFloat(ua.split('Opera/')[1]) || undefined; 133 | 134 | var canTransition = (function() { 135 | var ver = parseFloat(ua.split('Version/')[1]) || undefined; 136 | // test to determine if this browser can handle CSS transitions. 137 | var cachedCanTransition = 138 | (isWK || (isFF && isFF > 3.6 ) || (isOpera && ver >= 10.5)); 139 | return function() { return cachedCanTransition; } 140 | })(); 141 | 142 | // 143 | // Slide class 144 | // 145 | var Slide = function(node, idx) { 146 | this._node = node; 147 | if (idx >= 0) { 148 | this._count = idx + 1; 149 | } 150 | if (this._node) { 151 | addClass(this._node, 'slide distant-slide'); 152 | } 153 | this._makeCounter(); 154 | this._makeBuildList(); 155 | }; 156 | 157 | Slide.prototype = { 158 | _node: null, 159 | _count: 0, 160 | _buildList: [], 161 | _visited: false, 162 | _currentState: '', 163 | _states: [ 'distant-slide', 'far-past', 164 | 'past', 'current', 'future', 165 | 'far-future', 'distant-slide' ], 166 | setState: function(state) { 167 | if (typeof state != 'string') { 168 | state = this._states[state]; 169 | } 170 | if (state == 'current' && !this._visited) { 171 | this._visited = true; 172 | this._makeBuildList(); 173 | } 174 | removeClass(this._node, this._states); 175 | addClass(this._node, state); 176 | this._currentState = state; 177 | 178 | // delay first auto run. Really wish this were in CSS. 179 | /* 180 | this._runAutos(); 181 | */ 182 | var _t = this; 183 | setTimeout(function(){ _t._runAutos(); } , 400); 184 | }, 185 | _makeCounter: function() { 186 | if(!this._count || !this._node) { return; } 187 | var c = doc.createElement('span'); 188 | c.innerHTML = this._count; 189 | c.className = 'counter'; 190 | this._node.appendChild(c); 191 | }, 192 | _makeBuildList: function() { 193 | this._buildList = []; 194 | if (disableBuilds) { return; } 195 | if (this._node) { 196 | this._buildList = query('[data-build] > *', this._node); 197 | } 198 | this._buildList.forEach(function(el) { 199 | addClass(el, 'to-build'); 200 | }); 201 | }, 202 | _runAutos: function() { 203 | if (this._currentState != 'current') { 204 | return; 205 | } 206 | // find the next auto, slice it out of the list, and run it 207 | var idx = -1; 208 | this._buildList.some(function(n, i) { 209 | if (n.hasAttribute('data-auto')) { 210 | idx = i; 211 | return true; 212 | } 213 | return false; 214 | }); 215 | if (idx >= 0) { 216 | var elem = this._buildList.splice(idx, 1)[0]; 217 | var transitionEnd = isWK ? 'webkitTransitionEnd' : (isFF ? 'mozTransitionEnd' : 'oTransitionEnd'); 218 | var _t = this; 219 | if (canTransition()) { 220 | var l = function(evt) { 221 | elem.parentNode.removeEventListener(transitionEnd, l, false); 222 | _t._runAutos(); 223 | }; 224 | elem.parentNode.addEventListener(transitionEnd, l, false); 225 | removeClass(elem, 'to-build'); 226 | } else { 227 | setTimeout(function() { 228 | removeClass(elem, 'to-build'); 229 | _t._runAutos(); 230 | }, 400); 231 | } 232 | } 233 | }, 234 | buildNext: function() { 235 | if (!this._buildList.length) { 236 | return false; 237 | } 238 | removeClass(this._buildList.shift(), 'to-build'); 239 | return true; 240 | }, 241 | }; 242 | 243 | // 244 | // SlideShow class 245 | // 246 | var SlideShow = function(slides) { 247 | this._slides = (slides || []).map(function(el, idx) { 248 | return new Slide(el, idx); 249 | }); 250 | 251 | var h = window.location.hash; 252 | try { 253 | this.current = parseInt(h.split('#slide')[1], 10); 254 | }catch (e) { /* squeltch */ } 255 | this.current = isNaN(this.current) ? 1 : this.current; 256 | var _t = this; 257 | doc.addEventListener('keydown', 258 | function(e) { _t.handleKeys(e); }, false); 259 | doc.addEventListener('mousewheel', 260 | function(e) { _t.handleWheel(e); }, false); 261 | doc.addEventListener('DOMMouseScroll', 262 | function(e) { _t.handleWheel(e); }, false); 263 | doc.addEventListener('touchstart', 264 | function(e) { _t.handleTouchStart(e); }, false); 265 | doc.addEventListener('touchend', 266 | function(e) { _t.handleTouchEnd(e); }, false); 267 | window.addEventListener('popstate', 268 | function(e) { _t.go(e.state); }, false); 269 | this._update(); 270 | }; 271 | 272 | SlideShow.prototype = { 273 | _slides: [], 274 | _update: function(dontPush) { 275 | document.querySelector('#presentation-counter').innerText = this.current; 276 | if (history.pushState) { 277 | if (!dontPush) { 278 | history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current); 279 | } 280 | } else { 281 | window.location.hash = 'slide' + this.current; 282 | } 283 | for (var x = this.current-1; x < this.current + 7; x++) { 284 | if (this._slides[x-4]) { 285 | this._slides[x-4].setState(Math.max(0, x-this.current)); 286 | } 287 | } 288 | }, 289 | 290 | current: 0, 291 | next: function() { 292 | if (!this._slides[this.current-1].buildNext()) { 293 | this.current = Math.min(this.current + 1, this._slides.length); 294 | this._update(); 295 | } 296 | }, 297 | prev: function() { 298 | this.current = Math.max(this.current-1, 1); 299 | this._update(); 300 | }, 301 | go: function(num) { 302 | if (!num) return; 303 | if (history.pushState && this.current != num) { 304 | history.replaceState(this.current, 'Slide ' + this.current, '#slide' + this.current); 305 | } 306 | this.current = num; 307 | this._update(true); 308 | }, 309 | 310 | _notesOn: true, 311 | showNotes: function() { 312 | var isOn = this._notesOn = !this._notesOn; 313 | var elements = document.querySelectorAll('.notes'); 314 | for(var i = 0, length = elements.length; i < length; i++) { 315 | elements[i].style.display = (isOn) ? '' : 'none'; 316 | } 317 | }, 318 | switch3D: function() { 319 | toggleClass(document.body, 'three-d'); 320 | }, 321 | handleWheel: function(e) { 322 | var delta = 0; 323 | if (e.wheelDelta) { 324 | delta = e.wheelDelta/120; 325 | if (isOpera) { 326 | delta = -delta; 327 | } 328 | } else if (e.detail) { 329 | delta = -e.detail/3; 330 | } 331 | 332 | if (delta > 0 ) { 333 | this.prev(); 334 | return; 335 | } 336 | if (delta < 0 ) { 337 | this.next(); 338 | return; 339 | } 340 | }, 341 | handleKeys: function(e) { 342 | 343 | if (/^(input|textarea)$/i.test(e.target.nodeName)) return; 344 | //console.dir(e.target); 345 | if(e.target.contentEditable == "true") return; 346 | switch (e.keyCode) { 347 | case 37: // left arrow 348 | this.prev(); break; 349 | case 39: // right arrow 350 | case 32: // space 351 | this.next(); break; 352 | case 50: // 2 353 | this.showNotes(); break; 354 | case 51: // 3 355 | this.switch3D(); break; 356 | } 357 | }, 358 | _touchStartX: 0, 359 | handleTouchStart: function(e) { 360 | this._touchStartX = e.touches[0].pageX; 361 | }, 362 | handleTouchEnd: function(e) { 363 | var delta = this._touchStartX - e.changedTouches[0].pageX; 364 | var SWIPE_SIZE = 150; 365 | if (delta > SWIPE_SIZE) { 366 | this.next(); 367 | } else if (delta< -SWIPE_SIZE) { 368 | this.prev(); 369 | } 370 | }, 371 | }; 372 | 373 | // Initialize 374 | var slideshow = new SlideShow(query('.slide')); 375 | })(); 376 | -------------------------------------------------------------------------------- /files/00_basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 26 | CSS Selector Test 27 | 28 | 29 | 30 |
    31 |
  1. item 1
  2. 32 |
  3. item 2
  4. 33 |
  5. item 3 34 |
      35 |
    • item a
    • 36 |
    • item b
    • 37 |
    • item c
    • 38 |
    39 |
  6. 40 |
  7. item 4 (myclass)
  8. 41 |
  9. item 5
  10. 42 |
  11. item 6
  12. 43 |
  13. item 7
  14. 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /files/01_attr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 22 | CSS Selector Test 23 | 24 | 25 |
    26 |
  1. First List Item - <li class="myClass" title="unicorns eat rainbows">
  2. 27 |
  3. Second List Item has a span - <li>Second List Item has a <span>span</span></li>
  4. 28 |
  5. Third List Item - <li class="myClass">
  6. 29 |
  7. Fourth List Item
  8. 30 |
  9. Fifth List Item 31 |
      32 |
    • Child 1 external pdf - <a href="http://site.com/file.pdf" title="external pdf file">
    • 33 |
    • Child 2
    • 34 |
    • Child 3
    • 35 |
    36 |
  10. 37 |
  11. Sixth List Item
  12. 38 |
  13. Seventh List Item - <li id="myID">
  14. 39 |
  15. Eighth List Item
  16. 40 |
  17. Ninth List Item - <li class="myClass">
  18. 41 |
  19. Tenth List Item with an external Link - <a href="http://standardista.com">Link</a>
  20. 42 |
  21. Eleventh List Item with a PDF - <a href="local.pdf" title="a local pdf file">PDF</a>
  22. 43 |
  23. Twelvth List Item
  24. 44 |
  25. Thirteenth List Item - <li title="unicorn ate a rainbow">
  26. 45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /files/02_uiselectors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 25 | CSS UI Selector 26 | 27 | 28 |
    29 |
  1. 30 |
  2. 31 | 32 |
  3. 33 |
  4. 34 | 35 | 36 |
  5. 37 |
  6. 38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /files/03_root.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 27 | CSS UI Selector 28 | 29 | 30 |
    31 |
  1. 32 |
  2. 33 | 34 |
  3. 35 |
  4. 36 | 37 | 38 |
  5. 39 |
  6. 40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /files/04_firstlastonly.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 20 | CSS UI Selector 21 | 22 | 23 | 24 |
25 |

This is a H1

26 |

Carz wtf noice pour uh saiz hoi.

27 |

Oh winz lol wuv donutz yu. Herrow not wut carz pwety oh hornz.

28 |

Bere noze dum cheezeburger oh. Notise hai mikrosoft foots. Dum oh iz nuthing gravy haz nozbody finking. Funnae hai nom winz noze r.

29 |
30 | 31 |
32 |

This is an H1

33 |

Sheeze dum can compewters flowerz. Loike choosday noice nom samez do hornz mac n. Funnae pour hoi dided gravy samez ghoast I.

34 |

U pwety oh haz cat ghoast hai. Taytoes hornz hunnae hai meeeow ghoast. 35 |

36 |

This is an h2

37 |

Sheeze meeeow dum uh dided cat nom hornz wuv.

38 |

Donutz scratchin mac n dum rong ded gravy.

39 |

Thx chz can hoi wtf. Evrybody yu u ded choosday evrybody hai neether. Iz hai dided sheeze bukket noice nozzing chz watzzup?.

40 |

this is another h2

41 |

Graet samez iz iz nozbody saiz sheeze oh carz. Jest kitteh not scratchin herrow. Nom scratchin rong saiz ya kitteh haz chz nom.

42 |

Graet gravy gravy mikrosoft. Dided winz cheezeburger finking samez wtf foots. Gravy wut mac n partay noice noze foots.

43 |

Can sink nom compewter ur ded how herrow cat.

44 |
45 | 46 |

This is the 3rd h1

47 |

Wut owwch owwch noze. Thx rong watzzup? graet. Watzzup? feat saiz watzzup? neether.

48 |

Look, an H2. 49 | Lol evryfink compewters loike wut.

50 |

Ur hunnae graet hoi noice finking sink wut. Ghoast invizible compewters bukket.

51 |

Sink feat can hornz watzzup? finking finking flowerz. Scratchin mac n bere invizible. Compewter pour nozzing gravy carz hai lol.

52 |

This is an H3

53 |

Funnae lol ded dum bukket loike winz. Carz kitteh nozbody wtf wtf haz. Invizible bere hornz herrow.

54 |

Oh nom hoi feathurz evryfink nom yu invizible. Hoi flowerz invizible uh. Ded oh invizible nuthing r lol pwety.

55 |

Feat flowerz neether oh scratchin cat ghoast.

56 |
57 | 58 |

Only h1 in an otherwise empty div

59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /files/05_nth.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 19 | CSS UI Selector 20 | 21 | 22 | 23 |
    24 |
  1. list item
  2. 25 |
  3. list item
  4. 26 |
  5. list item
  6. 27 |
  7. list item
  8. 28 |
  9. list item
  10. 29 |
  11. list item
  12. 30 |
  13. list item
  14. 31 |
  15. list item
  16. 32 |
  17. list item
  18. 33 |
  19. list item
  20. 34 |
  21. list item
  22. 35 |
  23. list item
  24. 36 |
  25. list item
  26. 37 |
  27. list item
  28. 38 |
  29. list item
  30. 39 |
  31. list item
  32. 40 |
  33. list item
  34. 41 |
  35. list item
  36. 42 |
  37. list item
  38. 43 |
  39. list item
  40. 44 |
  41. list item
  42. 45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /files/06_not.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 19 | CSS Selector Test 20 | 21 | 22 |
    23 |
  1. First List Item - <li class="myClass" title="unicorns eat rainbows">
  2. 24 |
  3. Second List Item has a span - <li>Second List Item has a <span>span</span></li>
  4. 25 |
  5. Third List Item - <li class="myClass">
  6. 26 |
  7. Fourth List Item
  8. 27 |
  9. Fifth List Item 28 |
      29 |
    • Child 1 external pdf - <a href="http://site.com/file.pdf" title="external pdf file">
    • 30 |
    • Child 2
    • 31 |
    • Child 3
    • 32 |
    33 |
  10. 34 |
  11. Sixth List Item
  12. 35 |
  13. Seventh List Item - <li id="myID">
  14. 36 |
  15. Eighth List Item
  16. 37 |
  17. Ninth List Item - <li class="myClass">
  18. 38 |
  19. Tenth List Item with an external Link - <a href="http://standardista.com">Link</a>
  20. 39 |
  21. Eleventh List Item with a PDF - <a href="local.pdf" title="a local pdf file">PDF</a>
  22. 40 |
  23. Twelvth List Item
  24. 41 |
  25. Thirteenth List Item - <li title="unicorn ate a rainbow">
  26. 42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /files/07_target.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 48 | 49 | 59 | CSS Selector Test 60 | 61 | 62 | 63 |
64 |
65 | Tab 1 66 |
Bacon ipsum dolor sit amet flank shank filet mignon prosciutto, frankfurter pork shankle tail short ribs pork belly short loin sirloin. Pig shank prosciutto tail short ribs, boudin spare ribs t-bone capicola bresaola.
67 |
68 |
69 | Tab 2 70 |
Beef chuck cow beef ribs kielbasa, venison hamburger ribeye biltong t-bone prosciutto strip steak boudin turducken flank.
71 |
72 |
73 | Tab 3 74 |
Jerky swine meatloaf, venison spare ribs boudin hamburger leberkase short ribs ball tip shoulder.
75 |
76 |
77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /files/08_dropcap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | 32 | CSS Drop Caps 33 | 34 | 35 | 36 |

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.

37 |

This is a second paragraph. If it had a drop-cap this site would be ugly!

38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /files/100_simpletransforms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | 23 | Simple Transforms 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /files/101_transform3dhtml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 28 | Transform origin 29 | 30 | 31 | 32 |
33 |

Apply perspective to parent element. smaller # = closer; larger # = farther

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /files/101_transformorigin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | 26 | Transform origin 27 | 28 | 29 | 30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /files/102_backface.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 28 | Transform origin 29 | 30 | 31 | 32 |
33 |

Apply perspective to parent element. smaller # = closer; larger # = farther

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /files/11_specificity.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 18 | CSS Selector Test 19 | 20 | 21 |
    22 |
  1. First List Item - <li class="myClass" title="unicorns eat rainbows">
  2. 23 |
  3. Second List Item has a span - <li>Second List Item has a <span>span</span></li>
  4. 24 |
  5. Third List Item - <li class="myClass">
  6. 25 |
  7. Fourth List Item
  8. 26 |
  9. Fifth List Item 27 |
      28 |
    • Child 1 external pdf - <a href="http://site.com/file.pdf" title="external pdf file">
    • 29 |
    • Child 2
    • 30 |
    • Child 3
    • 31 |
    32 |
  10. 33 |
  11. Sixth List Item
  12. 34 |
  13. Seventh List Item - <li id="myID">
  14. 35 |
  15. Eighth List Item
  16. 36 |
  17. Ninth List Item - <li class="myClass">
  18. 37 |
  19. Tenth List Item with an external Link - <a href="http://standardista.com">Link</a>
  20. 38 |
  21. Eleventh List Item with a PDF - <a href="local.pdf" title="a local pdf file">PDF</a>
  22. 39 |
  23. Twelvth List Item
  24. 40 |
  25. Thirteenth List Item - <li title="unicorn ate a rainbow">
  26. 41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /files/12_flexbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 29 | Flexbox 30 | 31 | 32 | 33 |
34 |
one
35 |
two
36 |
three
37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /files/31_generatetext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 26 | Generate Text 27 | 28 | 29 | 30 |

are

31 |
<p> are </p>
32 | Text is editable, and p has an id of text 33 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /files/32_generatetext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 27 | Generate Text 28 | 29 | 30 | 31 |

are

32 |
<p> are </p>
33 | Text is editable 34 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /files/32b_generatetext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | 31 | Quotes 32 | 33 | 34 | 35 |

With generated content you can created text effects.

36 | 37 |

We'll cover other uses next.

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /files/33_bubbles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 35 | Generate Text 36 | 37 | 38 | 39 |

This is a quote

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /files/34_bubbles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 46 | Thought bubble 47 | 48 | 49 | 50 |

This is a thought bubble

51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /files/35_tooltip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 47 | 48 | 49 | 50 |

In this section you have learned the general idea of using generated content to create effects and / or to provide additional information. Try hovering over me to find out how awesome generated content can be.

51 |

Open up a text editor and try creating a tooltip without looking at the code. But, if you must, the code is attached, or you can check out your web inspector.

52 |

Here is one solution

53 | 54 | 55 | -------------------------------------------------------------------------------- /files/40_supports.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 18 | @supports 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /files/72_boxshadow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 35 | box-shadow as borders 36 | 37 | 38 | 39 |

This has no borders

40 |

This has no borders

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /files/72a_boxshadow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 29 | box-shadow as borders 30 | 31 | 32 | 33 |

This has no borders

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /files/80_bgposition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 59 | 60 | 62 | Background-Position 63 | 64 | 65 | 66 |
67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /files/81_bgposition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 24 | 29 | CSS Selector Test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /files/81b_bgposition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 26 | 27 | 35 | CSS Selector Test 36 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /files/82_borderradius.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | 25 | CSS Border Radius 26 | 27 | 28 | 29 |
This is a div
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /files/83_longcat.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 23 | CSS Border Image 24 | 25 | 26 | 27 |
This is a very long cat
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /files/91_basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 18 | Basic Gradients 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /files/92_basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 18 | Basic Gradients 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /files/92_different_angles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 19 | Basic Gradients 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /icons/browser_logos-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/icons/browser_logos-64.png -------------------------------------------------------------------------------- /icons/new.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/icons/new.gif -------------------------------------------------------------------------------- /icons/oreilly.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/icons/oreilly.gif -------------------------------------------------------------------------------- /img/fish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/img/fish.png -------------------------------------------------------------------------------- /img/googlefonts.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/img/googlefonts.gif -------------------------------------------------------------------------------- /img/plankton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/img/plankton.png -------------------------------------------------------------------------------- /img/shark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/estelle/CSS-Workshop/3185af4b4513a87188cf682b403d70ee665ecf8b/img/shark.gif -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | CSS3: From Knowledgable to Ninja 12 | 13 | 14 | 15 | 45 | 46 | 47 | 48 | 49 |
50 | 51 |
52 |
53 | 59 |
60 |
61 |

62 | and to change slides. 63 | 2 for comments. estelle.github.com/CSS-Workshop 64 |

65 |
66 | 67 |
68 | 69 |
70 | 71 |
72 | 73 | 74 |
75 |
76 |

CSS: from Knowledgable to Ninja

77 |
78 |
79 | 80 |

Estelle Weyl
81 | @estellevw 82 |
83 | www.standardista.com

84 |

estelle.github.com/CSS-Workshop

85 |
86 |
87 | 88 | 89 |
90 | 91 | Visit Site 92 |
93 | 94 |
95 |
selectorA {
 96 |    property1: value1;
 97 |    property2: value2;
 98 | }
 99 | 
100 | selectorB {
101 |    property1: value3;
102 |    property2: value4;
103 | }
104 |
105 | 106 | 107 | 108 |
109 |
selector:pseudo-class::pseudo-element {
110 |     -vendor-property: value;
111 | }
112 | 
113 | selector[attribute],
114 | selector ~ relation {
115 |     property: -vendor-value;
116 |     -vendor-property: -vendor-value;
117 |     -vendor-property: weirdsyntax;
118 | }
119 |
120 | 121 | 122 |
123 |
@at-rule {
124 |     property: value;
125 |  }
126 | 
127 | @at-rule {
128 |     selector {
129 |     	property: value;
130 |     }
131 |     selector2 {
132 |     	property: value;
133 |     }
134 |  }
135 |
136 | 137 | 138 | 139 | 140 |
141 |

Course Outline

142 |
143 |
    144 |
  1. Selectors
  2. 145 |
  3. Specificity
  4. 146 |
  5. Generated Content
  6. 147 |
  7. Media Queries
  8. 148 |
  9. Debugging
  10. 149 |
  11. Colors & Transparency
  12. 150 |
  13. Fonts / Typography
  14. 151 |
  15. Backgrounds & Borders
  16. 152 |
  17. Gradients
  18. 153 |
  19. Transforms
  20. 154 |
  21. Transitions & Animation
  22. 156 |
  23. Other Features
  24. 157 |
158 |
159 |
160 | 161 | 162 | 163 |
164 |

Slide Notes/Exercise Files

165 |
166 |

Many exercise files open in a separate window. When they do, they will all open in the same seperate window

167 |

Other exercise files are incorporated in the deck. If the slide is grey or reads "try this", you can edit the CSS in the head to impact the rest of the slide.

168 |

If you are unable to move between slides, click anywhere OUTSIDE the slide, and try again

169 |

To take notes, click on #4.

170 |
171 |
172 | 173 | 174 | 175 |
176 |

Selectors

177 |
178 |
    179 |
  • Basic Selectors
  • 180 |
  • Relational selectors
  • 181 |
  • Selector list
  • 182 |
  • selector support grid
  • 183 |
  • Intro to Attribute selectors
  • 184 |
  • Older attribute selectors
  • 185 |
  • CSS3 Attribute Selectors
  • 186 |
  • Attribute Selectors Examples
  • 187 |
  • Using attribute selectors
  • 188 |
  • UI pseudo-classes
  • 189 |
  • Form related UI pseudo-classes
  • 190 |
  • UI selectors
  • 191 |
  • List of Structural selectors
  • 192 |
  • :root
  • 193 |
  • First, last, & only
  • 194 |
  • nth pseudo-classes
  • 195 |
  • Structural Selectors
  • 196 |
  • :empty pseudo-class
  • 197 |
  • :not - Negation pseudo-class
  • 198 |
  • lang, target, anchor links
  • 199 |
  • Pseudo elements
  • 200 |
  • selectors tips
  • 201 |
202 |
203 |
204 | 205 |
206 |

Specificity

207 |
208 |
    209 |
  • Understanding Specificity
  • 210 |
  • Specificity PDF
  • 211 |
  • Specificity Notes
  • 212 |
213 |
214 |
215 | 216 |
217 |

Generated Content

218 |
219 |
    220 |
  • before and ::after
  • 221 |
  • Understanding Generated Content
  • 222 |
  • Faux Elements
  • 223 |
  • Syntax
  • 224 |
  • Special Character
  • 225 |
  • Simple Use Cases
  • 226 |
  • Informative Links
  • 227 |
  • Quote & Thought bubbles
  • 228 |
  • shapes
  • 229 |
  • Other ideas
  • 230 |
  • Exercise
  • 231 |
232 |
233 |
234 | 235 |
236 |

Media Queries

237 |
238 |
239 |
    240 |
  • Syntax
  • 241 |
  • Old Media Queries
  • 242 |
  • New Media Queries
  • 243 |
  • More Media Query Tidbits
  • 244 |
  • In action
  • 245 |
  • mediaqueri.es
  • 246 |
247 |
248 |
249 | 250 | 251 |
252 |

Debugging

253 |
254 |
    255 |
  • Debuggers
  • 256 |
  • Pseudo Elements / Shadow DOM
  • 257 |
258 |
259 |
260 | 261 | 262 |
263 |

Colors

264 |
265 |
    266 |
  • Color formats
  • 267 |
  • Color Keywords
  • 268 |
  • RGB / RGBA
  • 269 |
  • HSL / HSLA
  • 270 |
  • HSLA / RGBA / HEX conversion
  • 271 |
  • Opacity
  • 272 |
  • AlphaTransparency
  • 273 |
  • AlphaTransparency Tips
  • 274 |
  • Color Tips
  • 275 |
  • Depracated UI Keyterm Colors
  • 276 |
  • -moz-appearance / -webkit-appearance
  • 277 |
278 |
279 |
280 | 281 | 282 | 283 |
284 |

Fonts

285 |
286 |
    287 |
  • @font-face 288 |
      289 |
    • Syntax
    • 290 |
    • Support
    • 291 |
    • Gotchas
    • 292 |
    293 |
  • 294 |
  • Font Resources
  • 295 |
  • Text Shadow
  • 296 |
  • Box-shadow
  • 297 |
  • Text-stroke
  • 298 |
  • W3C Text Module
  • 299 |
300 |
301 |
302 | 303 | 304 |
305 |

Backgrounds and Borders

306 |
307 |
    308 |
  • Background properties 309 |
      310 |
    • background-color
    • 311 |
    • background-image'
    • 312 |
    • background-repeat
    • 313 |
    • background-attachment
    • 314 |
    • background-position
    • 315 |
    • background-clip
    • 316 |
    • background-origin
    • 317 |
    • background-size
    • 318 |
    • background shorthand
    • 319 |
    320 |
  • 321 |
322 | 323 |
    324 |
  • Border properties 325 |
      326 |
    • border-color
    • 327 |
    • border-style
    • 328 |
    • border-width
    • 329 |
    • border shorthand
    • 330 |
    • border-radius
    • 331 |
    332 |
  • 333 |
  • Border Images 334 |
      335 |
    • border-image-source
    • 336 |
    • border-image-slice
    • 337 |
    • border-image-width
    • 338 |
    • border-image-outset
    • 339 |
    • border-image-repea
    • 340 |
    • border-image shorthand
    • 341 |
    342 |
  • 343 |
344 |
345 |
346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 |
354 |

Gradients

355 |
356 |
    357 |
  • Types of Gradients
  • 358 |
  • Angles & Keyterm directions
  • 359 |
  • Color Stops
  • 360 |
  • Linear Gradients
  • 361 |
  • Angled patterns
  • 362 |
  • with Background-size
  • 363 |
  • Radial Gradients
  • 364 |
365 |
366 |
367 | 368 | 369 |
370 |

Tranforms

371 |
372 |
    373 |
  • 2D Transform Functions
  • 374 |
  • 3D Transform Functions
  • 375 |
  • Transform Related Properties
  • 376 |
  • Multiple Transforms
  • 377 |
378 |
379 |
380 | 381 | 382 |
383 |

Transitions & Animations

384 |
385 |
    386 |
  • Transtion Propertes
  • 387 |
  • What can be transitioned?
  • 388 |
  • Animation Keyframes
  • 389 |
  • Animation Properties
  • 390 |
391 |
392 |
393 | 394 |
395 |

Other Features

396 |
397 |
    398 |
  • Columns
  • 399 |
  • Box Sizing
  • 400 |
  • CSS Regions
  • 401 |
  • FlexBox & Grids
  • 402 |
  • Cursors
  • 403 |
  • Text Overflow
  • 404 |
  • Word Wrap
  • 405 |
  • calc()
  • 406 |
  • rem
  • 407 |
  • Pointer Events
  • 408 |
  • -webkit-user-modify
  • 409 | 410 |
411 |
412 |
413 | 414 |
415 |

Get Started

416 |
417 |

Next ➹

418 |
419 |
420 | 421 |
422 | 423 | 424 | 425 | -------------------------------------------------------------------------------- /part_01_selectors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | CSS3: From Knowledgable to Ninja 12 | 15 | 16 | 17 | 98 | 99 | 100 | 101 | 102 |
103 | 104 |
105 | 106 |
107 |

108 | and to change slides. 109 | 2 for comments. estelle.github.com/CSS-Workshop 110 |

111 |
112 | 113 |
114 | 115 |
116 | 117 |
118 | 119 | 120 |
121 |
122 |

CSS: from Knowledgable to Ninja

123 |
124 |
125 |

◈ Estelle Weyl

126 |

@estellevw

www.standardista.com

127 |
128 |
129 | 130 | 131 |
132 |

Course Outline

133 |
134 |
  1. Selectors
  2. 135 |
  3. Specificity
  4. 136 |
  5. Generated Content
  6. 137 |
  7. Media Queries
  8. 138 |
  9. Debugging
  10. 139 |
  11. Colors & Transparency
  12. 140 |
  13. Fonts / Typography
  14. 141 |
  15. Backgrounds & Borders
  16. 142 |
  17. Gradients
  18. 143 |
  19. Transforms
  20. 144 |
  21. Transitions & Animation
  22. 145 |
  23. Other Features
  24. 146 |
147 |
148 |
149 | 150 | 151 |
152 |

Basic Selectors

153 |
154 |
<ul> 
155 |  <li id="myID" class="myClass">item 1</li>
156 |  <li class="myClass">item 2</li>    
157 |  <li>item 3</li>
158 | </ul> 
159 |
160 |
#myID
161 |
ID
162 |
.myClass
163 |
class
164 |
li
165 |
tag name
166 |
167 |
168 |
169 | 170 | 171 |
172 |

Relational selectors

173 |
174 |
175 |
    176 |
  1. item 1
  2. 177 |
  3. item 2
  4. 178 |
  5. item 3 179 |
      180 |
    • item a
    • 181 |
    • item b
    • 182 |
    • item c
    • 183 |
    184 |
  6. 185 |
  7. item 4
  8. 186 |
  9. item 5
  10. 187 |
  11. item 6
  12. 188 |
  13. item 7
  14. 189 |
190 |
191 |
192 |
ul li
193 |
descendant selector
194 | matches nested <li>s
195 |
ol > li
196 |
child selector 
197 | matches <li>s in <ol> but not nested <ul>
198 |
li.myClass + li
199 |
adjacent sibling 
200 |
NEW  (IE7+)
201 | li.myClass ~ li
202 |
203 | general sibling selector
204 | matches later siblings, but not nested.
205 |
206 |

Try it out

207 |
208 |
209 | 210 | 211 | 212 | 213 |
214 |

Lots 'o Selectors

215 |
216 | 217 |
    218 |
  • *
  • 219 |
  • E
  • 220 |
  • .class
  • 221 |
  • #id
  • 222 |
  • E F
  • 223 |
  • E > F
  • 224 |
  • E + F
  • 225 |
  • E[attribute]
  • 226 |
  • E[attribute=value]
  • 227 |
  • E[attribute~=value]
  • 228 |
  • E[attribute|=value]
  • 229 |
  • :first-child
  • 230 |
  • :lang()
  • 231 |
  • :before
  • 232 |
  • ::before
  • 233 |
  • ::selection
  • 234 |
  • :after
  • 235 |
  • ::after
  • 236 |
  • :first-letter
  • 237 |
  • ::first-letter
  • 238 |
  • :first-line
  • 239 |
  • ::first-line
  • 240 |
  • E[attribute^=value]
  • 241 |
  • E[attribute$=value]
  • 242 |
  • E[attribute*=value]
  • 243 |
  • E ~ F
  • 244 |
  • :root
  • 245 |
  • :last-child
  • 246 |
  • :only-child
  • 247 |
  • :nth-child()
  • 248 |
  • :nth-last-child()
  • 249 |
  • :first-of-type
  • 250 |
  • :last-of-type
  • 251 |
  • :only-of-type
  • 252 |
  • :nth-of-type()
  • 253 |
  • :nth-last-of-type()
  • 254 |
  • :empty
  • 255 |
  • :not()
  • 256 |
  • :target
  • 257 |
  • :enabled
  • 258 |
  • :disabled
  • 259 |
  • :checked
  • 260 |
  • :indeterminate
  • 261 |
  • :default
  • 262 |
  • :valid
  • 263 |
  • :invalid
  • 264 |
  • :in-range
  • 265 |
  • :out-of-range
  • 266 |
  • :required
  • 267 |
  • :optional
  • 268 |
  • :read-only
  • 269 |
  • :read-write
  • 270 |
271 |
272 |
273 | 274 | 275 |
276 |
277 | 278 | 279 | 280 | 281 |
282 |

Attribute selectors

283 |
284 |
285 |
element[attribute]
286 |
Select elements containing the named attribute
287 |
288 |
img[alt] {}
289 |      <img src="image.jpg" alt="accessible">     
290 |      <img src="image.jpg" title="inaccessible">  
291 | form [type] {} 
292 |      <input type=date>  
293 |      <select>
294 |

IE6 sucks 
295 | IE7 support basic non-empty attribute

296 |
297 |
298 | 299 | 300 |
301 |

Older attribute selectors

302 |
303 |
304 |
E[attr]
305 |
Element E that has the attribute attr with any value.
306 |
E[attr="val"]
307 |
Element E that has the attribute attr with the exact, case-sensitive if attribute is case sensitive, value val.
308 |
E[attr|=val]
309 |
Element E whose attribute attr has a value val or begins with val- ("val" plus "-").
310 |
p[lang|="en"]{/*    <p lang="en-us">  <p lang="en-uk"> */ }
311 |
312 |
E[attr~=val]
313 |
Element E whose attribute attr has within its value the space-separated full word val.
314 |
a[title~=more] {/* <a title="want more info about this?">}
315 |
316 |
317 |
318 | 319 | 320 |
321 |

CSS3 Attribute Selectors

322 |
323 |
324 |
E[attr^=val]
325 |
Element E whose attribute attr starts with the value val.
326 |
a[href^=mailto] {background-image: url(emailicon.gif);}  
327 | a[href^=http]:after {content: " (" attr(href) ")";}
328 |
329 |
E[attr$=val]
330 |
Element E whose attribute attr ends in val . 
331 |
a[href$=pdf] {background-image: url(pdficon.gif);}
332 | a[href$=pdf]:after {content: " (PDF)";}
333 |
334 |
E[attr*=val]
335 |
Element E whose attribute attr matches val anywhere within the attribute. Similar to E[attr~=val] above, except the val can be part of a word.
336 |
337 |

Note: Multiple attributes work! a[title][href]

338 |
339 |
340 | 341 | 342 |
343 |

Attribute Selectors Recap

344 |
345 |
346 | input[placeholder] { 
347 | /* matches any input with a placeholder */}
348 | input[type=email] {
349 | /* exact match */}
350 | abbr[title~=unicorn] { 
351 | /* matches unicorn but not unicorns */}
352 | abbr[title|=en] { 
353 | /* matches en-us and en-uk */}
354 | a[href^=mailto] { 
355 | /* starts with */}
356 | a[href$=pdf]{ 
357 | /* ends in */}
358 | abbr[title*=unicorn] { 
359 | /* matches unicorn and unicorns */}
360 | 
361 |
E:[att] 
/* have the attribute at all */
362 | 363 | E:[att=val]
/* exact */
364 | 365 | E:[att~=val]
/* val is a space separated word */
366 | 367 | E:[att|=val]
/* with a dash */
368 | 369 | E:[att^=val]
/* begins with val */
370 | 371 | E:[att$=val]
/* ends with val */
372 | 373 | E:[att*=val]
/* val is anywhere as a substring */
374 | .
375 |
376 | @media print{
377 |   abbr[title]:after { 
378 |     content: "(" attr(title) ")";
379 |   }
380 |   a[href^=http]:after { 
381 |     content: "(" attr(href) ")";
382 |   }
383 | }
384 |
385 |
386 | 387 | 388 |
389 |

Using attribute selectors

390 |
391 |

Play Time: Attribute Selectors

392 |

Note: The top line of the example is editable. The CSS will impact the contents on the rest of the page.

393 |
394 |
395 | 396 | 397 |
398 |

UI pseudo-classes

399 |
400 |

Based on current state of UI

401 |
402 |   :enabled
403 |   
404 |   :disabled
405 |   
406 |   :checked
407 |   
408 |

Example:

409 |

input[type=checkbox]:checked + label {
410 |   color: red;
411 | }
412 |
413 |
414 |
415 |
416 | 417 | 418 |
419 |

Form related UI pseudo-classes

420 |
421 |
:valid
422 | :invalid
423 | :required
424 | :optional
425 | 
426 | 
427 | :in-range
428 | :out-of-range
429 | :read-only
430 | :read-write
431 | 
432 | :default
433 |

Example:

434 |

input:valid { border: 1px solid green;}
435 | input:invalid { border: 1px solid red;}
436 | input:required {border-width: 5px;}
437 | input:optional {border-width: 10px;}
438 | input:out-of-range { background-color: pink;}
439 | input:in-range { background-color:lightgreen;}
440 |
441 |
442 | 443 |
444 |
445 | 446 | 447 |
448 |

UI selectors

449 |
450 |

Play Time: UI Selectors

451 |

Test them out for yourselves

452 |
453 |
454 | 455 | 456 | 457 |
458 |

Structural selectors

459 |
460 |
:nth-child() 
461 | 
462 | :nth-last-child() 
463 | 
464 | :nth-of-type() 
465 | 
466 | :nth-last-of-type() 
467 | 
468 | :first-child*
469 | 
470 | :last-child 
471 | 
472 | :first-of-type 
473 | 
474 | :last-of-type 
475 | 
476 | :only-child 
477 | 
478 | :only-of-type 
479 | 
480 | :root
481 | 
482 | :empty
483 | 
484 | :not(:empty) 
485 | 
486 |
  • Target elements on the page based on their relationships to other elements in the DOM.
  • 487 |
  • Updates dynamically if page updates.
  • 488 | 489 |
  • Reduced need for extra markup, classes and IDs
  • 490 |
491 | * CSS2 / IE8 492 |
493 |
494 | 495 | 496 | 497 |
498 |

First, last, & only

499 |
500 |
 
501 | :first-child
502 | 
503 | :last-child 
504 | 
505 | :first-of-type 
506 | 
507 | :last-of-type 
508 | 
509 | :only-child 
510 | 
511 | :only-of-type 
512 | 
513 | 514 |

Easier to explain by example

515 |
516 |
517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 |
526 |

nth pseudo-classes

527 |
528 |
:nth-child(3n) 
529 | 
530 | :nth-last-child(odd) 
531 | 
532 | :nth-of-type(5) 
533 | 
534 | :nth-last-of-type(3n+1) 
535 | 536 |

Target element or elements based on argument passed to the selector

537 |
    538 |
  • :nth-of-type(even)
  • 539 |
  • :nth-of-type(odd)
  • 540 |
  • :nth-of-type(an+b)
  • 541 |
542 |

Let's Play Note: Play with negative values for 'a'

543 |
544 |
545 | 546 | 547 |
548 |

Structural Selectors

549 |
550 |
551 | tr:first-child,
552 | tr:last-child {
553 |   font-weight: bold;
554 | }
555 | tr:first-of-type,
556 | tr:last-of-type{
557 |   text-decoration:line-through;
558 | }
559 | tr:nth-child(even) {
560 |   background-color: #CCC;
561 | }
562 | tr:nth-child(3) {
563 |   color: #CCC;
564 | }
565 | tr:nth-of-type(odd) {
566 |   background-color: #FFF;
567 | }
568 | tr:nth-of-type(4n) {
569 |   color: #C61800;
570 | }
571 | tr:nth-of-type(3n-1) {
572 |   font-style: italic;
573 | }
574 | 
575 | 
576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 |
Row 1
Row 2
Row 3
Row 4
Row 5
Row 6
Row 7
Row 8
Row 9
Row 10
590 |
591 |
592 | 593 | 594 |
595 |

Structural Selectors

596 |
597 |
  • 1
598 |
  • 1
  • 2
599 |
  • 1
  • 2
  • 3
600 |
  • 1
  • 2
  • 3
  • 4
601 |
 li:first-of-type:last-of-type{width: 100%;}
602 |  li:nth-of-type(1):nth-last-of-type(2),
603 |  li:nth-of-type(2):nth-last-of-type(1){width: 50%;}
604 |  li:nth-of-type(1):nth-last-of-type(3),
605 |  li:nth-of-type(3):nth-last-of-type(1),
606 |  li:nth-of-type(2):nth-last-of-type(2){width: 33.33%;}
607 |  li:nth-of-type(1):nth-last-of-type(4),
608 |  li:nth-of-type(2):nth-last-of-type(3),
609 |  li:nth-of-type(3):nth-last-of-type(2),
610 |  li:nth-of-type(4):nth-last-of-type(1){width: 25%;}
611 |
612 |
613 | 614 | 615 | 616 |
617 |

:empty pseudo-class

618 |
619 |
p:empty {
620 |   	/* styles here */
621 |     }
622 | 
623 |

Matches: 624 |

<p></p>
625 | <p><!-- this is a comment --></p>
626 | 
627 |
628 |
629 | 630 | 631 | 632 |
633 |

:not - Negation pseudo-class

634 |
635 |
636 |  div:not(.excludeMe)
637 | 638 |

Practice makes perfect

639 |
640 |
641 | 642 | 643 |
644 |

Other Pseudo Classes

645 |
646 |
647 |   :lang
648 |   :target
649 |   
650 |

link & user action pseudo-classes

651 |
652 |   :link
653 |   :visited
654 |   
655 |   :hover
656 |   :active
657 |   :focus
658 |   
659 |

:target example

660 |
661 |
662 | 663 | 664 | 665 |
666 |

:root

667 |
668 |
 
669 | :root
670 | 
671 | 672 |

Selects the document root, which is <html>

673 |
  • Declare font-size on :root if using rem units
  • 674 |
  • Style :root only if showing <head> (as in our exercise files)
  • 675 | 676 |
  • In CSS4, define Defining Variables on root. (see Variables module)
  • 677 |
678 |

example

679 |
680 |
681 | 682 | 683 | 684 |
685 |

Pseudo elements

686 |
687 | 688 | 689 |
690 |

Pseudo elements

691 |
692 |
693 | ::first-line
694 | ::first-letter
695 | ::selection (not in specification)
696 | ::before
697 | ::after
698 |     
699 | 700 |

Pseudo-classes select elements that 701 | 702 | already exist.
703 | 704 | Pseudo-elements create "faux" elements you can style.

705 | 706 |

Use single colon because of IE

707 |
708 |
709 | 710 | 711 | 712 |
713 |

::first-letter

714 |
715 | 716 |

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. Code for drop cap.

p:first-of-type::first-letter {
717 | 	position: relative;
718 | 	top: 8px;
719 | 	float: left;
720 | 	font-size: 3em;
721 | 	line-height: 1;
722 | 	color: #C7573A;
723 | 	padding: 0 4px 2px 0;
724 | 	font-weight: bold;	
725 | }
726 |  
727 |
728 |
729 | 730 | 731 | 732 |
733 |

::selection

734 |
735 | 736 |
.thisSlide *::selection {
737 |    background-color: #C61800;
738 |    color: #ffffff;
739 | }
740 |     
741 |

Prefix with -moz- for Firefox
742 | Use single colon because of IE

743 |
744 |
745 | 746 | 747 | 748 |
749 |

Tips

750 |
751 |
    752 |
  • selectivizr.com + JS Library = JS for backward compatibility
  • 753 |
  • jQuery $(selector) == document.querySelectorAll(selector)
  • 754 |
  • Many, many more pseudo-elements with prefixes currently treated as a shadow DOM 755 |
    • ::-webkit-progress-bar
    • 756 |
    • ::-webkit-progress-value
    • 757 |
    • ::-webkit-meter-even-less-good-value 758 |
    • 759 |
    • ::-webkit-inner-spin-button /outer-spin-button 760 |
    • 761 |
    • ::-webkit-validation-bubble / arrow-clipper /arrow /message
    • 762 |
    • ::-webkit-scrollbar
    • 763 |
    • ::-webkit-scrollbar-button / thumb / track 764 |
    • Mozilla Pseudo-elements and pseudo-classes
    • 765 | 766 |
    767 |
  • 768 | 769 |
770 |
771 |
772 | 773 | 774 |
775 |

Specificity

776 |
777 |

Next ➹

778 |
779 |
780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 |
791 | 792 | 793 | 794 | -------------------------------------------------------------------------------- /part_02_specificity.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | CSS3: From Knowledgable to Ninja 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 |
24 | 30 |
31 |
32 |

33 | and to change slides. 34 | 2 for comments. estelle.github.com/CSS-Workshop 35 |

36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 | 44 | 45 |
46 |
47 |

CSS: from Knowledgable to Ninja

48 |
49 |
50 |

◈ Estelle Weyl

51 |

@estellevw

www.standardista.com

52 |
53 |
54 | 55 | 56 | 74 | 75 | 76 | 77 |
78 |

Part 2: Specificity

79 |
80 | 81 | 82 |
83 |

Understanding Specificity

84 |
85 |
    86 |
  • ID
  • 87 |
  • Class
  • 88 |
  • Element
  • 89 |
90 |
    91 |
  • 1-0-0
  • 92 |
  • 0-1-0
  • 93 |
  • 0-0-1
  • 94 |
95 |

PDF
96 | Examples

97 |
98 |
99 | 100 | 101 |
102 | 103 |
104 | 105 | 106 |
107 |

Specificity: The less than obvious

108 |
109 |

The * selector, or global selector, has no value.

110 |
* {} 0-0-0 
111 | 112 |

Combinators, like ~, >, and + have no value

113 |
ul li {} 0-0-2
114 | ul > li {} 0-0-2
115 | 116 |

:not has no value, but parameter selector does

117 |
.myClass:not(p) {} 0-1-1
118 | 119 |

Specificity is not inheritance

120 |
121 |
122 | 123 | 124 |
125 |

Play Time

126 | 127 | Try it out 128 |
129 | 130 | 131 |
132 |

Part 3: Generated Content

133 |

Next ➹

134 |
135 | 136 | 137 | 138 | 139 | 140 |
141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /part_03_generated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | CSS3: Generated Content 12 | 13 | 14 | 15 | 212 | 213 | 214 | 215 |
216 | 222 |
223 |
224 | 225 |
226 | 227 |
228 |

229 | and to change slides. 230 | 2 for comments. estelle.github.com/CSS-Workshop 231 |

232 |
233 | 234 |
235 | 236 |
237 | 238 |
239 | 240 |
241 |
242 |

CSS: from Knowledgable to Ninja

243 |
244 |
245 |

◈ Estelle Weyl

246 |

@estellevw

www.standardista.com

247 |
248 |
249 | 250 | 251 |
252 |

Course Outline

253 |
254 |
  1. Selectors
  2. 255 |
  3. Specificity
  4. 256 |
  5. Generated Content
  6. 257 |
  7. Media Queries
  8. 258 |
  9. Debugging
  10. 259 |
  11. Colors & Transparency
  12. 260 |
  13. Fonts / Typography
  14. 261 |
  15. Backgrounds & Borders
  16. 262 |
  17. Gradients
  18. 263 |
  19. Transforms
  20. 264 |
  21. Transitions & Animation
  22. 265 |
  23. Other Features
  24. 266 |
267 |
268 |
269 | 270 | 271 |
272 |

Part 3: Generated Content

273 |
274 | 275 | 276 | 277 |
278 |

::before and ::after

279 | 280 | 281 |
282 |
p:before {
283 |   content: "before content - ";
284 |   font-weight: bold;
285 | }
286 | p:after{
287 |   content: " - after content";
288 |   font-weight: bold;
289 | }
290 | 291 |
<p>the content</p>
292 | 293 |

the content

294 |
<p>
295 |     <before>before content - </before>
296 |         the content
297 |     <after> - after content</after>
298 | </p>
299 | Try it out
300 | 301 |
302 | 303 | 304 |
305 |

Try it out

306 | 307 | Try it out 308 |
309 | 310 | 311 | 312 | 313 |
314 |

Pseudo Elements

315 |
316 | You get 2 free stylable faux elements for every non-empty element 317 |
318 |
Content
319 |
320 |
321 |
322 | 323 | 324 |
325 |

Syntax

326 |
327 |
328 |  element:before {
329 |  	content: "REQUIRED";
330 |  }
331 |  
332 |
    333 |
  • Chrome
  • 334 |
  • Safari
  • 335 |
  • Firefox
  • 336 |
  • Opera
  • 337 |
  • IE 8
  • 338 |
339 |
340 |  element:before {
341 |     content: '';                  /* empty */
342 |     content: " (.pdf) ";          /* any text */
343 |     content: "\2603";             /* unicode */
344 |     content: " (" attr(href) ")"; /* attributes */
345 |     content: counter(name);
346 |         counter-increment: name;  /* counters */
347 |  }
348 |  
349 |
350 |
351 | 352 | 353 |
354 |

Special Character

355 |
356 |
357 |  element:before {
358 |  	content: "\2603";
359 |  }
360 |  
361 | 362 |

Try it out
363 | CopyPasteCharacter.com

364 | Calculator 365 |
366 |
367 | 368 | 369 |
370 |

Values for content:

371 |
372 |
373 |
none
374 |
Same as no content property declared.
375 |
normal
376 |
Same as no content property declared.
377 |
string
378 |
A string of text. Can be combined with URL, counter, attr(x), quotes, etc.
379 |
image
380 |
URL of a resource, usual an image
381 |
counter
382 |
'counter(name), counter(name, style), 'counters(name, string)' or 'counters(name, string, style)'. 'name' is a string, but not 'none', 'inherit' or 'initial'.
383 |
open-quote / close-quote
384 |
The appropriate string set in the  'quotes' property.
385 |
no-open-quote / no-close-quote
386 |
Does not include quotes, but increments the level of nesting for quotes.
387 |
attr(X)
388 |
Displays the value of the attribute 'X'
389 |
390 |
body {counter-reset: sections;}
391 | header h1.sectiontitle:before{
392 | 	content: "Part " counter(sections) ": ";
393 | 	counter-increment: sections;
394 | }
395 | Tutorial 396 |
397 |
398 | 399 |
400 |

attr() - FUTURE

401 |
402 |

CSS 2.1 403 |

attr( attrName )
404 |

CSS3

405 |
attr( attrName unit? [ , fallback ]? )
406 |
407 |
string
408 |
contents of a CSS string. Default is the empty string.
409 |
color
410 |
Must parse as a readable color. Default is ‘currentColor’.
411 |
url
412 |
Default is ‘about:invalid’. Relative URLs will be made absolute, not relative to the style sheet.
413 |
integer
414 |
Default is ‘0’
415 |
number
416 |
Default is ‘0’
417 |
length, angle, time or frequency
418 |
Default is ‘0’ in the relevant units. If the unit is a relative length, it will be computed to an absolute length.
419 |
length or unit token
420 |
'em’ ‘ex’ ‘px’ ‘rem’ ‘vw’ ‘vh’ ‘vmin’ ‘vmax’ ‘mm’ ‘cm’ ‘in’ ‘pt’ ‘pc’ ‘deg’ ‘grad’ ‘rad’ ‘ms’ ‘s’ ‘Hz’ ‘kHz’ or ‘%'. If the unit is a relative length, it will be computed to an absolute length.
421 |
422 |
<p data-count="5">Hi</p>
423 | 
424 | width: attr(data-count em, auto);
425 |
426 |
427 | 428 |
429 |

Try it out

430 | 431 | Try it out 432 |
433 | 434 | 435 | 436 |
437 |

Simple Use Cases

438 |
439 | 440 |
a:before {
441 |   color: #ffffff;
442 |   background: #000000;
443 |   font-size: 120%;
444 |   padding: 2px 5px;
445 |   display: inline-block;
446 |   width: 1.2em;
447 |   margin-right: 10px;
448 |   text-align: center;
449 | }
450 | a[href^="mailto:"]:before {
451 |   content: "\2709 ";
452 | }
453 | a[href^="tel:"]:before {
454 |   content: "\2706";
455 | }
456 | a[href$="vcs"]:before {
457 |   content: "\231A";
458 | }
459 | 460 | 465 |
466 |
467 | 468 | 469 |
470 |

Attribute Values as content

471 |
472 |

There are exercises, or you can search Google.

473 |
a[href^=http]:hover {
474 |    position: relative;
475 | }
476 | a[href^=http]:hover:after {
477 |    content: attr(href);
478 |    position: absolute;
479 |    top: 1em;
480 |    left: 0;
481 |    background-color: black;
482 |    color: white;
483 |    padding: 3px 5px;
484 |    line-height:1;
485 | } 
486 |
487 |
488 | 489 | 490 | 491 |
492 |

More uses

493 |
494 |
<blockquote>
495 |   <p>With generated content you can create text effects.</p>
496 |   <p>We'll cover other uses next.</p>
497 | </blockquote>
498 |
499 | blockquote p:before,
500 | blockquote p:after {
501 |   font-size: 2em;
502 |   color: #C7573A;
503 |   line-height: 0;
504 |   vertical-align: middle;
505 | }
506 | blockquote p:first-child:before {
507 |   content: "\275D";
508 |   margin: 0 5px 0 -40px;
509 | }
510 | blockquote p:last-child:after {
511 |   content: "\275E";
512 |   margin: 0 -40px 0 5px;
513 | }
514 |

With generated content you can created text effects.

We'll cover other uses next.

515 |
516 |
517 | 518 | 519 |
520 |

Quotes

521 |
522 | 523 |

This is a quote

524 | 525 |
.quote {
526 |     border-radius: 10px;
527 |     position:relative;
528 |     padding: 20px;
529 |     background-color: red;
530 |     color: white;
531 | }
532 | .quote:after {
533 |     position:absolute;
534 |     content: '';
535 |     width: 0; height:0;
536 |     border: 20px solid tran…
537 |     border-top-color: red;
538 |     bottom:-39px; left:20px;
539 | }
540 |
541 |
542 | 543 | 544 | 545 | 546 | 547 |
548 |

Thought bubbles

549 |
550 | 551 |

This is a thought bubble

552 | 553 |
.thought,.thought:before,
554 | .thought:after  {
555 |   border-radius: 50%;
556 |   border: 5px solid blue;
557 |   background-color: white;
558 |   position:relative;
559 | }
560 | .thought:before,
561 | .thought:after {
562 |   content: '';
563 |   position:absolute;
564 |   left: 20%; bottom: -30px;
565 |   height: 40px; width: 40px;
566 | }
567 | .thought:after {
568 |   left: 12%; bottom: -50px;
569 |   height: 20px; width: 20px;
570 | }
571 |
572 |
573 | 574 | 575 |
576 | 577 |

Shapes

578 | Visit Site 579 |
580 | 581 | 582 |
583 | 584 |

Other ideas

585 | Visit Site 586 |
587 | 588 | 589 |
590 |

Try it: Tool Tip

591 |
592 |

In this section you have learned the general idea of using generated content to create effects and / or to provide additional information. Try hovering over me to find out how awesome generated content can be.

593 |

Open up a text editor and try creating a tooltip without looking at the code. But, if you must, the code is attached, or you can check out your web inspector.

594 |

Here is one solution

595 |
596 |
597 | 598 | 599 |
600 |

Part 4:
Media Queries

601 |
(briefly)
602 |

Next ➹

603 |
604 | 605 |
606 | 607 | 608 | 609 | -------------------------------------------------------------------------------- /part_07_fonts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | CSS3: From Knowledgable to Ninja 12 | 13 | 14 | 15 | 73 | 74 | 75 | 76 | 77 |
78 | 84 |
85 | 86 |
87 |

88 | and to change slides. 89 | 2 for comments. estelle.github.com/CSS-Workshop 90 |

91 |
92 | 93 |
94 | 95 |
96 | 97 |
98 | 99 | 100 |
101 |
102 |

CSS: from Knowledgable to Ninja

103 |
104 |
105 | 106 | 107 |
108 |
109 |

CSS: from Knowledgable to Ninja

110 |
111 |
112 |

◈ Estelle Weyl

113 |

@estellevw

www.standardista.com

114 |
115 |
116 | 117 | 118 |
119 |

Course Outline

120 |
121 |
  1. Selectors
  2. 122 |
  3. Specificity
  4. 123 |
  5. Generated Content
  6. 124 |
  7. Media Queries
  8. 125 |
  9. Debugging
  10. 126 |
  11. Colors & Transparency
  12. 127 |
  13. Fonts / Typography
  14. 128 |
  15. Backgrounds & Borders
  16. 129 |
  17. Gradients
  18. 130 |
  19. Transforms
  20. 131 |
  21. Transitions & Animation
  22. 132 |
  23. Other Features
  24. 133 |
134 |
135 |
136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
145 |

Part 7: Fonts, Shadows & Text Effects

146 |
147 | 148 | 149 | 150 |
151 |

@font-face

152 |
153 |
154 | @font-face {
155 |   font-family: 'blah';
156 |   src: url('blah.eot');
157 |   src: url('blah.eot?#iefix')
158 |          format('embedded-opentype'),
159 |      url('blah.woff') format('woff'),
160 |      url('blah.ttf') format('truetype'),
161 |      url('blah.svg#blahRegular') format('svg');
162 |   font-weight: normal;
163 |   font-style: normal;
164 | }
165 | 
166 |
body {
167 |   font-family: 'blah', arial, sans-serif;
168 | }
169 | 170 |
171 |
172 | 173 | 174 |
175 |

@font-face

176 |
177 |
@font-face {
178 |   font-family: yourFontName;
179 |   src: url(fontfile) [, url(fontfile)]*;
180 |   [font-weight: bold|normal];
181 |   [font-style: italic|normal];
182 |   [charset: characterSet;]
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 |
FileChromeFirefoxOperaSafariInternet ExploreriOS mobileAndroid
EOT
TTF/OTF9✓ 4.2✓ 2.2
SVG✓ 3
WOFF✓ 11.1+✓ 5.1✓ 9✓ 5✓ 4.4
241 |
242 |
243 | 244 | 245 |
246 |

Issues

247 |
248 |
249 |
Who owns the font?
250 |
Do you have the legal right to distribute your chosen font?
251 |
No? There are services!
252 |
FOUT
253 |
Flicker of Unstyled Content
254 |
File Size
255 |
Character sets can be huge, so file sizes can be huge
256 |
Need a different file for each font style
257 |
Font services
258 |
259 |
260 |
261 | 262 | 263 |
264 | 265 |

Google Fonts

266 | Google Fonts 267 |
268 | 269 | 270 |
271 | 272 |

font-squirrel

273 | FontSquirrel @font-face generator 274 |
275 | 276 |
277 |

Shadows

278 |
279 | 280 | 281 |
282 |

Text Shadows

283 |
284 |
    285 |
  • 286 |
    287 | text-shadow: left top blur color;
    288 | 
    289 |
  • 290 |
  • Transparent Shadows 291 |
    292 | .trans { text-shadow: 0 5px 1px rgba(0,0,0,0.2);}
  • 293 |
  • Solid Shadows 294 | 295 |
    296 | .solid { text-shadow: 0 5px 1px #999;}
  • 297 |
298 |
299 |
300 | 301 | 302 |
303 |
304 |

Text Shadow

305 |
text-shadow:  0 2px 5px hsla(0, 0%, 0%, 0.2);
306 | text-shadow: [horiz] [vert] [blur] [color];
.textshadow { text-shadow:
307 |     0 1px #cccccc,
308 |     0 2px #c9c9c9,
309 |     0 3px #bbbbbb,
310 |     0 4px #b9b9b9,
311 |     0 5px #aaaaaa,
312 |     0 6px  1px  rgba(0, 0, 0, 0.1),
313 |     0 0    5px  rgba(0, 0, 0, 0.1),
314 |     0 1px  3px  rgba(0, 0, 0, 0.3),
315 |     0 3px  5px  rgba(0, 0, 0, 0.2),
316 |     0 5px  10px rgba(0, 0, 0, 0.25),
317 |     0 10px 10px rgba(0, 0, 0, 0.2),
318 |     0 20px 20px rgba(0, 0, 0, 0.15);
319 | }
320 |
    321 |
  • Chrome
  • 322 |
  • Safari
  • 323 |
  • Firefox 3.5
  • 324 |
  • Opera 9.5
  • 325 |
  • IE 10
  • 326 |
327 |
328 |
329 | 330 | 331 |
332 | 333 | Visit Site 334 |

Text-Shadow

335 |
336 | 337 | 338 |
339 | 340 | Visit Site 341 |
342 | 343 | 344 |
345 |

box-shadow

346 |
347 |
348 | box-shadow:
349 | 	inset 3px 3px 0 3px yellow,
350 | 	inset -3px -3px 0 5px blue,
351 | 	3px 3px 0 5px #666,
352 | 	-3px -3px 0 3px red;
353 | box-shadow:
354 |     inset? [horiz] [vert] [blur] [spread] [color];
355 | 
356 |
    357 |
  • Last shadow drawn 'first', under previous shadow
  • 358 |
  • Should still be -webkit- and -moz- prefixed for best support
  • 359 |
360 |
    361 |
  • Chrome / Chrome 10
  • 362 |
  • Safari 3 / Safari 5.1
  • 363 |
  • Firefox 3.5 / Firefox 4.0
  • 364 |
  • Opera 9 / Opera 10.5
  • 365 |

  • IE 9
  • 366 |
367 |
368 |
369 | 370 | 371 |
372 |

Multiple Borders with Box Shadow

373 | 374 | Try it out 375 |
376 | 377 | 378 | 379 |
380 | 381 |

Text-Stroke (not in spec)

382 | Visit Site 383 |
384 | 385 | 386 |
387 | 388 | Visit Site 389 |
390 | 391 | 392 |
393 |

Specifications

394 |
395 | W3C Text Module 396 | 397 |
398 | 399 |
hanging-punctuation
400 |
none | [ first || [ force-end | allow-end ] || last ]
401 |
hyphens
402 |
none | manual | auto
403 |
letter-spacing
404 |
<spacing-limit>
405 |
line-break
406 |
auto | loose | normal | strict
407 |
overflow-wrap
408 |
normal | break-word
409 |
tab-size
410 |
<integer> | <length>
411 |
text-align
412 |
[ [ start | end | left | right | center ] || <string> ] | justify | match-parent | start end
413 |
text-align-last
414 |
auto | start | end | left | right | center | justify
415 |
text-decoration
416 |
<text-decoration-line> || <text-decoration-style> || <text-decoration-color> || blink
417 |
text-decoration-color
418 |
<color>
419 |
text-decoration-line
420 |
none | [ underline || overline || line-through ]
421 |
text-decoration-skip
422 |
none | [ objects || spaces || ink || edges ]
423 |
text-decoration-style
424 |
solid | double | dotted | dashed | wavy
425 |
text-emphasis
426 |
‘<text-emphasis-style>’ || ‘<text-emphasis-color>’
427 |
text-emphasis-color
428 |
<color>
429 |
text-emphasis-position
430 |
[ above | below ] && [ right | left ]
431 |
text-emphasis-style
432 |
none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>
433 |
text-indent
434 |
[ <length> | <percentage> ] && [ hanging || each-line ]?
435 |
text-justify
436 |
auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida
437 |
text-shadow
438 |
none | [ <length>{2,3} && <color>? ]#
439 |
text-space-collapse
440 |
collapse | preserve | preserve-breaks
441 |
text-transform
442 |
none | [ [ capitalize | uppercase | lowercase ] || full-width || full-size-kana ]
443 |
text-underline-position
444 |
auto | alphabetic | [ below || [ left | right ] ]
445 |
text-wrap
446 |
normal | none | avoid
447 |
white-space
448 |
normal | pre | nowrap | pre-wrap | pre-line
449 |
word-break
450 |
normal | keep-all | break-all
451 |
word-spacing
452 |
<spacing-limit> (%)
453 |
word-wrap / overflow-wrap
454 |
normal | break-word
455 |
456 |
457 |
458 | 459 | 460 |
461 | 462 | Visit Site 463 |
464 | 465 | 466 |
467 |

Borders & Backgrounds

468 |
469 |

Next ➹

470 |
471 |
472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 |
483 | 484 |
485 | 486 | -------------------------------------------------------------------------------- /slides.js: -------------------------------------------------------------------------------- 1 | // JavaScript Document 2 | // Makes the slidedeck work 3 | 4 | (function() { 5 | var doc = document, 6 | disableBuilds = true, 7 | ctr = 0, 8 | spaces = /\s+/, 9 | a1 = [''], 10 | toArray = function(list) { 11 | return Array.prototype.slice.call(list || [], 0); 12 | }, 13 | byId = function(id) { 14 | if (typeof id == 'string') { return doc.getElementById(id); } 15 | return id; 16 | }, 17 | 18 | query = function(query, root) { 19 | if (!query) { return []; } 20 | if (typeof query != 'string') { return toArray(query); } 21 | if (typeof root == 'string') { 22 | root = byId(root); 23 | if(!root){ return []; } 24 | } 25 | root = root || document; 26 | var rootIsDoc = (root.nodeType == 9); 27 | var doc = rootIsDoc ? root : (root.ownerDocument || document); 28 | 29 | // rewrite the query to be ID rooted 30 | if (!rootIsDoc || ('>~+'.indexOf(query.charAt(0)) >= 0)) { 31 | root.id = root.id || ('qUnique' + (ctr++)); 32 | query = '#' + root.id + ' ' + query; 33 | } 34 | 35 | // don't choke on something like ".yada.yada >" 36 | if ('>~+'.indexOf(query.slice(-1)) >= 0) { query += ' *'; } 37 | return toArray(doc.querySelectorAll(query)); 38 | }, 39 | 40 | strToArray = function(s) { 41 | if (typeof s == 'string' || s instanceof String) { 42 | if (s.indexOf(' ') < 0) { 43 | a1[0] = s; 44 | return a1; 45 | } 46 | else { 47 | return s.split(spaces); 48 | } 49 | } 50 | return s; 51 | }, 52 | 53 | addClass = function(node, classStr) { 54 | classStr = strToArray(classStr); 55 | var cls = ' ' + node.className + ' '; 56 | for (var i = 0, len = classStr.length, c; i < len; ++i) { 57 | c = classStr[i]; 58 | if (c && cls.indexOf(' ' + c + ' ') < 0) { 59 | cls += c + ' '; 60 | } 61 | } 62 | node.className = cls.trim(); 63 | }, 64 | 65 | removeClass = function(node, classStr) { 66 | var cls; 67 | if (classStr !== undefined) { 68 | classStr = strToArray(classStr); 69 | cls = ' ' + node.className + ' '; 70 | for (var i = 0, len = classStr.length; i < len; ++i) { 71 | cls = cls.replace(' ' + classStr[i] + ' ', ' '); 72 | } 73 | cls = cls.trim(); 74 | } else { 75 | cls = ''; 76 | } 77 | 78 | if (node.className != cls) { 79 | node.className = cls; 80 | } 81 | 82 | }, 83 | 84 | toggleClass = function(node, classStr) { 85 | var cls = ' ' + node.className + ' '; 86 | if (cls.indexOf(' ' + classStr.trim() + ' ') >= 0) { 87 | removeClass(node, classStr); 88 | } else { 89 | addClass(node, classStr); 90 | } 91 | }, 92 | 93 | 94 | 95 | ua = navigator.userAgent, 96 | isFF = parseFloat(ua.split('Firefox/')[1]) || undefined, 97 | isWK = parseFloat(ua.split('WebKit/')[1]) || undefined, 98 | isOpera = parseFloat(ua.split('Opera/')[1]) || undefined, 99 | 100 | 101 | 102 | canTransition = (function() { 103 | var ver = parseFloat(ua.split('Version/')[1]) || undefined; 104 | // test to determine if this browser can handle CSS transitions. 105 | var cachedCanTransition = 106 | 107 | (isWK || (isFF && isFF > 3.6 ) || (isOpera && ver >= 10.5)); 108 | return function() { return cachedCanTransition; } 109 | 110 | } 111 | )(); 112 | 113 | 114 | //-----------------------------------------------------------------// 115 | 116 | var Slide = function(node, idx) { 117 | this._node = node; 118 | if (idx >= 0) { 119 | this._count = idx + 1; 120 | } 121 | if (this._node) { 122 | addClass(this._node, 'slide distant-slide'); 123 | } 124 | this._makeCounter(); 125 | this._makeBuildList(); 126 | }; 127 | 128 | 129 | 130 | Slide.prototype = { 131 | _node: null, 132 | _count: 0, 133 | _buildList: [], 134 | _visited: false, 135 | _currentState: '', 136 | _states: [ 'distant-slide', 'far-past', 137 | 'past', 'current', 'future', 138 | 'far-future', 'distant-slide' ], 139 | setState: function(state) { 140 | if (typeof state != 'string') { 141 | state = this._states[state]; 142 | } 143 | 144 | if (state == 'current' && !this._visited) { 145 | this._visited = true; 146 | this._makeBuildList(); 147 | } 148 | 149 | removeClass(this._node, this._states); 150 | addClass(this._node, state); 151 | this._currentState = state; 152 | 153 | 154 | 155 | var _t = this; 156 | setTimeout(function(){ _t._runAutos(); } , 400); 157 | }, 158 | 159 | _makeCounter: function() { 160 | if(!this._count || !this._node) { return; } 161 | 162 | var c = doc.createElement('span'); 163 | c.innerHTML = this._count; 164 | c.className = 'counter'; 165 | this._node.appendChild(c); 166 | }, 167 | 168 | _makeBuildList: function() { 169 | this._buildList = []; 170 | if (disableBuilds) { return; } 171 | 172 | if (this._node) { 173 | this._buildList = query('[data-build] > *', this._node); 174 | } 175 | 176 | this._buildList.forEach(function(el) { 177 | addClass(el, 'to-build'); 178 | }); 179 | }, 180 | 181 | _runAutos: function() { 182 | if (this._currentState != 'current') { 183 | return; 184 | } 185 | 186 | // find the next auto, slice it out of the list, and run it 187 | 188 | var idx = -1; 189 | this._buildList.some(function(n, i) { 190 | if (n.hasAttribute('data-auto')) { 191 | idx = i; 192 | return true; 193 | } 194 | 195 | return false; 196 | }); 197 | if (idx >= 0) { 198 | var elem = this._buildList.splice(idx, 1)[0]; 199 | var transitionEnd = isWK ? 'webkitTransitionEnd' : (isFF ? 'mozTransitionEnd' : 'oTransitionEnd'); 200 | var _t = this; 201 | if (canTransition()) { 202 | var l = function(evt) { 203 | elem.parentNode.removeEventListener(transitionEnd, l, false); 204 | _t._runAutos(); 205 | }; 206 | elem.parentNode.addEventListener(transitionEnd, l, false); 207 | removeClass(elem, 'to-build'); 208 | } else { 209 | setTimeout(function() { 210 | removeClass(elem, 'to-build'); 211 | _t._runAutos(); 212 | }, 400); 213 | } 214 | 215 | } 216 | 217 | }, 218 | 219 | buildNext: function() { 220 | if (!this._buildList.length) { 221 | return false; 222 | } 223 | 224 | removeClass(this._buildList.shift(), 'to-build'); 225 | return true; 226 | }, 227 | 228 | }; 229 | 230 | 231 | 232 | // 233 | // SlideShow class 234 | // 235 | 236 | var SlideShow = function(slides) { 237 | this._slides = (slides || []).map(function(el, idx) { 238 | return new Slide(el, idx); 239 | }); 240 | 241 | 242 | 243 | var h = window.location.hash; 244 | try { 245 | this.current = parseInt(h.split('#slide')[1], 10); 246 | } catch (e) { /* squeltch */ } 247 | 248 | this.current = isNaN(this.current) ? 1 : this.current; 249 | var _t = this; 250 | doc.addEventListener('keydown', function(e) { _t.handleKeys(e); }, false); 251 | doc.addEventListener('mousewheel', function(e) { _t.handleWheel(e); }, false); 252 | doc.addEventListener('DOMMouseScroll', function(e) { _t.handleWheel(e); }, false); 253 | doc.addEventListener('touchstart', function(e) { _t.handleTouchStart(e); }, false); 254 | doc.addEventListener('touchend', function(e) { _t.handleTouchEnd(e); }, false); 255 | window.addEventListener('popstate', function(e) { _t.go(e.state); }, false); 256 | doc.getElementById('back').addEventListener('click', function(e) {_t.prev();}, false); 257 | doc.getElementById('next').addEventListener('click', function(e) {_t.next();}, false); 258 | this._update(); 259 | }; 260 | 261 | 262 | 263 | SlideShow.prototype = { 264 | _slides: [], 265 | 266 | _update: function(dontPush) { 267 | document.querySelector('#presentation-counter').innerText = this.current; 268 | if (history.pushState) { 269 | if (!dontPush) { 270 | history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current); 271 | } 272 | } else { 273 | window.location.hash = 'flopslide' + this.current; 274 | } 275 | for (var x = this.current-1; x < this.current + 7; x++) { 276 | if (this._slides[x-4]) { 277 | this._slides[x-4].setState(Math.max(0, x-this.current)); 278 | } 279 | } 280 | }, 281 | 282 | current: 0, 283 | 284 | next: function() { 285 | if (!this._slides[this.current-1].buildNext()) { 286 | this.current = Math.min(this.current + 1, this._slides.length); 287 | this._update(); 288 | } 289 | }, 290 | prev: function() { 291 | this.current = Math.max(this.current-1, 1); 292 | this._update(); 293 | }, 294 | 295 | go: function(num) { 296 | if (!num) return; 297 | if (history.pushState && this.current != num) { 298 | history.replaceState(this.current, 'Slide ' + this.current, '#slide' + this.current); 299 | } 300 | this.current = num; 301 | this._update(true); 302 | }, 303 | 304 | 305 | 306 | _notesOn: false, 307 | 308 | showNotes: function() { 309 | var isOn = this._notesOn = !this._notesOn; 310 | query('.notes').forEach(function(el) { 311 | el.style.display = (isOn) ? '' : 'none'; 312 | }); 313 | }, 314 | 315 | 316 | handleWheel: function(e) { 317 | var delta = 0; 318 | if (e.wheelDelta) { 319 | delta = e.wheelDelta/120; 320 | if (isOpera) { 321 | delta = -delta; 322 | } 323 | } 324 | else if (e.detail) { 325 | delta = -e.detail/3; 326 | } 327 | 328 | if (delta > 0 ) { 329 | this.prev(); 330 | return; 331 | } 332 | if (delta < 0 ) { 333 | this.next(); 334 | return; 335 | } 336 | }, 337 | 338 | addNotes: function(){ 339 | if(document.querySelector('.current textarea.mynotes')) { 340 | document.querySelector('.current textarea.mynotes').classList.toggle('temphidden'); 341 | return; 342 | } 343 | var ta = document.createElement('textarea'), 344 | currentSlide = document.querySelector('.current section'), 345 | path = window.location.pathname, 346 | A = path.lastIndexOf('/') + 1, 347 | B = path.lastIndexOf('.'), 348 | firstPartOfKey, key; 349 | if(B && B > A){ 350 | firstPartOfKey = path.substring(A, B); 351 | } else { 352 | firstPartOfKey = path.substring(1, path.length-1) || 'home'; 353 | } 354 | //console.log(firstPartOfKey); 355 | key = firstPartOfKey + window.location.hash; 356 | ta.value = window.localStorage.getItem(key) || ''; 357 | ta.className = 'mynotes'; 358 | 359 | ta.addEventListener('keyup', function(){ 360 | //console.log(key + ' ' + ta.value) 361 | window.localStorage.setItem(key,ta.value); 362 | }); 363 | currentSlide.appendChild(ta); 364 | }, 365 | 366 | 367 | removeHidingClass: function(){ 368 | var paragraphToShow = document.querySelector('.current .temphidden'); 369 | if(paragraphToShow) {paragraphToShow.classList.remove('temphidden');} 370 | 371 | }, 372 | 373 | handleKeys: function(e) { 374 | // disable keys for these elements 375 | if (/^(input|textarea|pre|object)$/i.test(e.target.nodeName)) return; 376 | 377 | 378 | switch (e.keyCode) { 379 | case 37: // left arrow 380 | case 33: // left clicker 381 | this.prev(); break; 382 | case 39: // right arrow 383 | case 32: // space 384 | case 34: // clicker right 385 | this.next(); break; 386 | case 50: // 2 387 | case 190: // 2 388 | this.showNotes(); 389 | this.removeHidingClass(); 390 | break; 391 | case 52: // 4 (for taking notes with local storage (students) 392 | this.addNotes(); break; 393 | break; 394 | } 395 | }, 396 | 397 | _touchStartX: 0, 398 | handleTouchStart: function(e) { 399 | this._touchStartX = e.touches[0].pageX; 400 | }, 401 | 402 | handleTouchEnd: function(e) { 403 | var delta = this._touchStartX - e.changedTouches[0].pageX; 404 | var SWIPE_SIZE = 150; 405 | if (delta > SWIPE_SIZE) { 406 | this.next(); 407 | } else if (delta< -SWIPE_SIZE) { 408 | this.prev(); 409 | } 410 | }, 411 | }; 412 | 413 | // Initialize 414 | var slideshow = new SlideShow(query('.slide')); 415 | //this.next(); 416 | })(); --------------------------------------------------------------------------------