Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The CSS of Tomorrow

The CSS of Tomorrow

A look into the longer-term future of CSS; rich layouts and a programmatic syntax. Guest starring Superman!

Avatar for Peter Gasston

Peter Gasston

October 20, 2011
Tweet

More Decks by Peter Gasston

Other Decks in Programming

Transcript

  1. “35 Awesome CSS3 Examples!” “50+ Best CSS3 Examples!” “350+ Amazing

    CSS3 Resources - All You'll Ever Need to Become a CSS3 Master!”
  2. MEDIA QUERIES @media all and (min-device-width: 480px) @media all and

    (pixel-ratio: 2) @media screen not (monochrome) @media screen and (max-device-width: 640px) and (touch-enabled: 1)
  3. TRANSITIONS & ANIMATIONS @keyframes foo { from { color: #f00;

    } 50% { color: #00f; } to { color: #0f0; } } div { animation: foo 1s linear; } transition: all 2s 500ms ease-in;
  4. MULTIPLE COLUMNS div { column-count: 3; column-width: 25em; column-gap: 1.5em;

    column-rule: 3px double #f00; } h2 { column-span: all; }
  5. FLEXIBLE BOX LAYOUT A B div { display: flexbox; }

    .a,.b { width: 40%; } A B .a,.b { width: flex(1); } A B .a { width: flex(3); } .b { width: flex(2); }
  6. FLEXIBLE BOX LAYOUT a .a { flex-align: center; flex-pack: center;

    width: flex(0); } c a b div { flex-flow: column; } .a,.b { flex-order: 2; } .c { flex-order: 1; }
  7. GRID LAYOUT div { display: grid; grid-columns: 1fr 1fr 2fr;

    } div { display: grid; grid-columns: 1fr 1fr 2fr; grid-rows: 80px auto 10em; }
  8. GRID LAYOUT a b c .a { grid-cell: a; }

    .b { grid-cell: b; } .c { grid-cell: c; } a b c div { grid-template: 'abc'; }
  9. GRID LAYOUT a b c div { grid-template: 'aa' 'bc';

    } a b c div { grid-template: 'acc' 'a.b'; }
  10. REGIONS a b .a { flow-into: foo; } .b {

    flow-from: foo; } b c d e .b, .c, .d, .e { flow-from: foo; } @region .b { color: #f00 }
  11. LINE GRID article { layout-grid-line: 1.5; } h1 { layout-grid-mode:

    block; } p { layout-grid-mode: line; margin-bottom: 1gd; }
  12. PAGED MEDIA @media paged { height: 100%; overflow: paged-x; }

    <link rel="next" href="p2.htm"> @navigation { nav-right: link-rel(next); }
  13. VALUES width: calc((12em * 3) + 10px); height: min(3em, 30px);

    list-style-type: cycle(disk, circle); content: attr(href);
  14. CONDITIONAL RULES @supports (display: grid) {} @supports (display: box) and

    (background: linear-gradient) {} @supports (display: box) or (background: linear-gradient) {} @supports not (transform: rotate3d) {}
  15. NESTING h1 { border: 1px solid #f00; & a {

    color: #00f; &:hover { color: #ff0; } } }
  16. Superman copyright is a contentious issue, but the images I

    use here belong to DC Comics and no permission was given. I hope they fall under fair use doctrines. You should buy a copy of All Star Superman – it’s really good! LEGAL NOTE