SlideShare a Scribd company logo
Aaron Gustafson
@aarongustafson
You are already
 using HTML5
FUTURE OF WEB DESIGN NYC 2011




HTML 4.01
                                html
                       meta head link style
                 title base body dl dt dd
            bdo script noscript map dfn b
         object param p div ul ol li           cite
      iframe address area img br a i small
   pre code abbr kbd var q samp               hr menu
   textarea ins del sub sup span strong
      select option optgroup label             input
        form fieldset legend button             u em
           blockquote h1 h2 h3 h4 h5 h6
               table caption col colgroup
                      thead tbody tfoot tr
                                th td
FUTURE OF WEB DESIGN NYC 2011




HTML5
                                html
                       meta head link style
                 title base body dl dt dd              section article
            bdo script noscript map dfn b aside details summary
         object param p div ul ol li           cite    canvas audio video
      iframe address area img br a i small nav figure figcaption
   pre code abbr kbd var q samp               hr menu header footer command
   textarea ins del sub sup span strong time source datalist
      select option optgroup label             input    output ruby progress
        form fieldset legend button             u em mark hgroup meter
           blockquote h1 h2 h3 h4 h5 h6                wbr keygen embed
               table caption col colgroup                  rt rp
                      thead tbody tfoot tr
                                th td
FUTURE OF WEB DESIGN NYC 2011




Our focus today
                                html
                       meta head link style
                 title base body dl dt dd              section article
            bdo script noscript map dfn b aside details summary
         object param p div ul ol li           cite    canvas audio video
      iframe address area img br a i small nav figure figcaption
   pre code abbr kbd var q samp               hr menu header footer command
   textarea ins del sub sup span strong time source datalist
      select option optgroup label             input    output ruby progress
        form fieldset legend button             u em mark hgroup meter
           blockquote h1 h2 h3 h4 h5 h6                wbr keygen embed
               table caption col colgroup                  rt rp
                      thead tbody tfoot tr
                                th td
What’s the
 easiest way to
“switch” a site to
    HTML5?
FUTURE OF WEB DESIGN NYC 2011




Fault tolerance
 <!DOCTYPE html>
Simpli cation
FUTURE OF WEB DESIGN NYC 2011




Simpli cation
 <html xmlns="http://www.w3.org/1999/xhtml"
       lang="en"
       xml:lang="en">



 <html lang="en">
FUTURE OF WEB DESIGN NYC 2011




Simpli cation
 <meta http-equiv="Content-Type"
       content="text/html; charset=utf-8">



 <meta charset="utf-8" />
FUTURE OF WEB DESIGN NYC 2011




Simpli cation
 <link rel="stylesheet" href="style-original.css" type="text/css" />
 <style type=”text/css”>
  /* … */
 </style>
 <script type=”text/javascript” src=”myscript.js”></script>



 <link rel="stylesheet" href="style-original.css" />
 <style>
  /* … */
 </style>
 <script src=”myscript.js”></script>
Organization
 9+   4+   6+   5+   11.1+
FUTURE OF WEB DESIGN NYC 2011




Organization
 <section>
  <!-- pretty much anything can go here -->
 </section>


 <article>
  <!-- pretty much anything can go here -->
 </article>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
section
section > article
HTML5 & CSS3 Workshop [FoWD NYC 2011]
article
article > section
FUTURE OF WEB DESIGN NYC 2011




Organization
 <header>
  <!-- titles, etc. go here -->
 </header>


 <footer>
  <!-- meta/supplementary information goes here -->
 </footer>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
header
HTML5 & CSS3 Workshop [FoWD NYC 2011]
footer
article
article > header
article
article > footer
FUTURE OF WEB DESIGN NYC 2011




Organization
 <nav>
  <ol>
    <li><a href="#details">Details</a></li>
    <li><a href="#lodging">Lodging</a></li>
    <li><a href="#location">Location</a></li>
    <li><a href="#topics">Topics</a></li>
    <li><a href="#contact">Contact Us</a></li>
  </ol>
  <p><a href="register">Register Now</a>
    <b>Only 5 spaces left</b></p>
 </nav>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
nav
HTML5 & CSS3 Workshop [FoWD NYC 2011]
nav
FUTURE OF WEB DESIGN NYC 2011




Organization
 <article>

    <!-- main content -->

    <aside>
     <!-- something related -->
    </aside>

 </article>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
aside
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Implicit sections (HTML 4)
                                <h1> HTML5
                                <p> HTML5 is currently under development...
                                <p> Like its immediate predecessors, HTML...


                                <h2> W3C standardization process
                                <p> The Web Hypertext Application...
                                <p> The HTML5 specification...
                                <p> According to the W3C timetable...
                                <p> Ian Hickson, editor of the HTML5...


                                <h2> Markup
                                <p> HTML5 introduces a number of...
                                <p> The HTML5 syntax is no longer...




                                 1 HTML5
                                 1.1 W3C standardization process
                                 1.2 Markup
FUTURE OF WEB DESIGN NYC 2011




Explicit sections (HTML5)
                                      <h1> HTML5
                                      <p> HTML5 is currently under development...
                                      <p> Like its immediate predecessors, HTML...


                                      <h2> W3C standardization process
                            section


                                      <p> The Web Hypertext Application...
                                      <p> The HTML5 specification...
                                      <p> According to the W3C timetable...
                                      <p> Ian Hickson, editor of the HTML5...


                                      <h2> Markup
                            section




                                      <p> HTML5 introduces a number of...
                                      <p> The HTML5 syntax is no longer...




                                       1 HTML5
                                       1.1 W3C standardization process
                                       1.2 Markup
FUTURE OF WEB DESIGN NYC 2011




Explicit sections (HTML5)
                                      <h1> HTML5
                                      <p> HTML5 is currently under development...
                                      <p> Like its immediate predecessors, HTML...


                                      <h1> W3C standardization process
                            section


                                      <p> The Web Hypertext Application...
                                      <p> The HTML5 specification...
                                      <p> According to the W3C timetable...
                                      <p> Ian Hickson, editor of the HTML5...


                                      <h1> Markup
                            section




                                      <p> HTML5 introduces a number of...
                                      <p> The HTML5 syntax is no longer...




                                       1 HTML5
                                       1.1 W3C standardization process
                                       1.2 Markup
FUTURE OF WEB DESIGN NYC 2011




Explicit sections (HTML5)
                                      <h1> HTML5
                                      <p> HTML5 is currently under development...
                                      <p> Like its immediate predecessors, HTML...


                                      <h4> W3C standardization process
                            section


                                      <p> The Web Hypertext Application...
                                      <p> The HTML5 specification...
                                      <p> According to the W3C timetable...
                                      <p> Ian Hickson, editor of the HTML5...


                                      <h6> Markup
                            section




                                      <p> HTML5 introduces a number of...
                                      <p> The HTML5 syntax is no longer...




                                       1 HTML5
                                       1.1 W3C standardization process
                                       1.2 Markup
FUTURE OF WEB DESIGN NYC 2011




    Sections
๏   section
๏   article
๏   aside
๏   footer
๏   header
๏   nav




                                    49
FUTURE OF WEB DESIGN NYC 2011




Outline limitations in HTML4
                                <h1> Title
                                <h2> Subtitle
                                <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...




                                 1 Title
                                 1.1 Subtitle
FUTURE OF WEB DESIGN NYC 2011




Heading groups (HTML5)

                            hgroup
                                     <h1> Title
                                     <h2> Subtitle
                                     <p> Text content continues...
                                     <p> Text content continues...
                                     <p> Text content continues...
                                     <p> Text content continues...
                                     <p> Text content continues...
                                     <p> Text content continues...
                                     <p> Text content continues...




                                      1 Title
FUTURE OF WEB DESIGN NYC 2011




Aside: rooted sections
                                <h1> Title
                                <p> Text content continues...
                                <p> Text content continues...


                                <h2> Section heading
                                <p> Text content continues...
                                <blockquote>
                                  <h2> Rooted heading
                                  <p> Text content continues...
                                  <p> Text content continues...
                                <p> Text content continues...
                                <p> Text content continues...




                                 1 Title
                                 1.1 Section heading
FUTURE OF WEB DESIGN NYC 2011




    Sectioning roots
๏   body
๏   blockquote
๏   details
๏   fieldset
๏   figure
๏   td




                                    53
Rede nition
FUTURE OF WEB DESIGN NYC 2011




Rede nition
The em element
Represents a span of text text with emphatic stress.

 <p>HTML5 introduces several <em>really</em> useful elements and
 a ton of new APIs.</p>


The strong element
Represents a span of text of great importance.

 <p>Please fill out the form below. <strong>Note: all
 fields are required.</strong></p>
FUTURE OF WEB DESIGN NYC 2011




Rede nition
The b element
Represents a span of text offset from its surrounding content, but of no extra
importance.

 <p>This presentation is about <b>HTML5</b>.</p>


The i element
Represents a span of text in an alternate voice or mood.

 <p>The <code>b</code> and <code>i</code> elements
 have been legitimized in HTML5. <i>Go figure.</i></p>

 <p>I like to work with markup languages because
 <strong>they are simple and easy to read</strong>.
 They also have that certain <i lang="fr" title="I
 don&#8217;t know what">je ne sais quoi</i>.</p>
FUTURE OF WEB DESIGN NYC 2011




Rede nition
The cite element
The title of a cited work (e.g. a book, magazine, or journal).

 <p>In <cite>Web Form Design</cite>, Luke Wroblewski draws on
 original research, his considerable experience at Yahoo! and eBay,
 and the perspectives of many of the field’s leading designers to
 show you everything you need to know about designing effective
 and engaging Web forms.</p>
FUTURE OF WEB DESIGN NYC 2011




Rede nition
The small element
Represents so-called “ ne print”
(e.g. disclaimers, caveats, etc.).
FUTURE OF WEB DESIGN NYC 2011




Rede nition
The hr element
Represents a paragraph-level thematic break.
Expansion
HTML5 & CSS3 Workshop [FoWD NYC 2011]
time
FUTURE OF WEB DESIGN NYC 2011




Expansion                                9+   4+   6+   5+   11.1+




 <time>October 25, 2010 8:11 PM</time>
FUTURE OF WEB DESIGN NYC 2011




Expansion                                  9+   4+   6+   5+   11.1+




 <time datetime="2010-10-25T20:11:00-05:00">
       October 25, 2010 8:11 PM</time>
FUTURE OF WEB DESIGN NYC 2011




Expansion                                  9+   4+   6+    5+   11.1+




 <time datetime="2010-10-25T20:11:00-05:00"
       pubdate="pubdate">October 25, 2010 8:11 PM</time>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
mark
mark
FUTURE OF WEB DESIGN NYC 2011




Expansion                                    9+   4+   6+   5+   11.1+




 <ol id="search-results">
  <li>
    <h3><a href="...">Web Upgrade <mark>HTML5</mark>
      May Weaken Privacy</a></h3>
    <p>The new language, <mark>HTML5</mark>, could give
      marketers access to many more details about users'
      online activities.</p>
  </li>
 </ol>
FUTURE OF WEB DESIGN NYC 2011




Expansion                                              6+   soon




 <details>
  <summary>This is the visible description</summary>
  <p>This content would be hidden by default.</p>
 </details>
FUTURE OF WEB DESIGN NYC 2011




Expansion                                       9+    4+   6+   5+   11.1+




 <figure id="fig-1">
  <img src="photo.jpeg" alt=""/>
  <figcaption>Photo of Albert Einstein</figcaption>
 </figure>


 <figure id="fig-2">
  <table>
    <caption>2011 Forecast Earnings</caption>
    <!-- a bunch of data -->
  </table>
 </figure>
Forms
10+   ~4+   ~4+   ~4+   ~9+
FUTURE OF WEB DESIGN NYC 2011




Forms




                <input type="email" …/>   <input type="url" …/>
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="date" name="dob"/>
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="number" name="foo"/>




 <input type="range" min="1" max="11" step=”1” name="foo"/>
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="color" name="foo"/>



                                #ff0000
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="text"
        pattern="d{6}w{3}"
        placeholder="6 digits followed by 3 letters"
        .../>
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="text"
        autocomplete
        autofocus
        form=”contact-form”
        required
        .../>
FUTURE OF WEB DESIGN NYC 2011




Forms
 <input type="text" list="countries" name="country"/>
 <datalist id="countries">
  <option>Afghanistan</option>
  <option>Åland Islands</option>
  <!-- ... -->
 </datalist>
Accessibility
 8+   3+   ~4+   ~4+   ~9.5+
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




What is it?
FUTURE OF WEB DESIGN NYC 2011




What is it?
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <button>Tweet</button>

 <a class=”button”>Tweet</a>
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <button>Tweet</button>

 <a class=”button”>Tweet</a>
FUTURE OF WEB DESIGN NYC 2011




What is it?
FUTURE OF WEB DESIGN NYC 2011




What is it?
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <button>Search Mail</button>

 <div>Search Mail</div>
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <button>Search Mail</button>

 <div>Search Mail</div>
FUTURE OF WEB DESIGN NYC 2011




ARIA maps the OS to the web
Semantics+
FUTURE OF WEB DESIGN NYC 2011




All the web’s a play…
 <section id="main" role="main">
  <!-- The primary content for the page would go here -->
 </section>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
<header role="banner">
<nav role="navigation">
<form role="search">
<section role="main">
HTML5 & CSS3 Workshop [FoWD NYC 2011]
<footer role="contentinfo">
<nav role="navigation">
HTML5 & CSS3 Workshop [FoWD NYC 2011]
<nav role="navigation">
FUTURE OF WEB DESIGN NYC 2011




Semantic comparison
              Ad-hoc                   ARIA Role               HTML5

 #header, #top                  banner                header (kind of)


 #main, #content                main                  none


 #extra, .sidebar               complementary, note   aside


 #footer, #bottom               contentinfo           footer


 #nav                           navigation            nav


 .hentry                        article               article
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




These are the droids you seek
 <span role="button">OK</span>


 <div role="alert">
  <p>Something went wrong.</p>
 </div>


 <div role="alertdialog">
  <p>Something went wrong.</p>
  <img src="x.png" alt="dismiss" role="button" />
 </div>
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <a role=”button”>Tweet</a>
    class=”button”>Tweet</a>
FUTURE OF WEB DESIGN NYC 2011




What is it?




 <a role=”button”>Tweet</a>
FUTURE OF WEB DESIGN NYC 2011




                                102
FUTURE OF WEB DESIGN NYC 2011




                                103
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




What’s happening?

                                B       B
                                (off)   (on)




 <span>
  <img src="bold-off.png" alt="bold" />
 </span>
 <span>
  <img src="bold-on.png" alt="bold" />
 </span>
FUTURE OF WEB DESIGN NYC 2011




What’s happening?

                                B       B
                                (off)   (on)




 <span>
  <img src="bold-off.png" alt="not bold" />
 </span>
 <span>
  <img src="bold-on.png" alt="bold" />
 </span>
FUTURE OF WEB DESIGN NYC 2011




What’s happening?

                                B       B
                                (off)   (on)




 <span role="button" aria-pressed="false">
  <img src="bold-off.png" alt="not bold" />
 </span>
 <span role="button" aria-pressed="true">
  <img src="bold-on.png" alt="bold" />
 </span>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!




 <input class="tweet-counter" value="140" disabled="disabled">
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!




 <span id="chars_left_notice" class="numeric">
  <strong id="status-field-char-counter"
        class="char-counter">140</strong>
 </span>
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!




 <span class="tweet-counter">140
  <b class="hidden"> characters remaining</b></span>


 .hidden {
   position: absolute;
   left: −999em;
 }
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!




 <span class="tweet-counter">maximum of 140 characters</span>



 <span class="tweet-counter">140
  <b class="hidden"> characters remaining</b></span>
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!




 <span aria-live="polite" aria-atomic="true"
       class="tweet-counter">140<b class="hidden">
       characters remaining</b></span>
FUTURE OF WEB DESIGN NYC 2011




Hey! Over here!
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
HTML5 & CSS3 Workshop [FoWD NYC 2011]
Bio-Break!
Microdata
FUTURE OF WEB DESIGN NYC 2011




Microdata
 <img src="nasty.png" data-nsfw="true"/>
FUTURE OF WEB DESIGN NYC 2011




Microdata
 <img src="low-res-photo.png" data-hi-res="high-res-photo.png"/>
FUTURE OF WEB DESIGN NYC 2011




Microdata
 <section id="comments">
  <a id="comment-loader"
     data-replace="/comments-only-for-url-title/"
     href="/article-with-comments">
     View comments on this entry and add your own
  </a>
 </section>
FUTURE OF WEB DESIGN NYC 2011




Microdata
 (function( $ ){
    $.fn.ajaxInclude = function(){
         return this.each(function(){
             var $el       = $( this ),
             target        = $el.data( 'target' ),
             $targetEl = target && $( target ) || $el,
             methods       = [ 'append', 'replace', 'before', 'after' ],
             ml            = methods.length,
             method, url;
             while ( ml-- ) {
                  method = methods[ ml ];
                  if ( $el.is( '[data-' + method + ']' ) ) {
                       url = $el.data( method ); break;
                  }
             }
             if ( method == 'replace' ){ method += 'With'; }
             if ( url && method ) {
                  $.get( url, function( data ){
                       $el.trigger( 'ajaxInclude', [$targetEl, data] );
                       $targetEl[ method ]( data );
                  });
             }
         });
     };
 })( jQuery );
Multimedia
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Audio
 <audio src="my.oga" controls="controls"></audio>
FUTURE OF WEB DESIGN NYC 2011




Audio
         Browser                .aac   .mp3   .oga   .wav

 Chrome 6+                      YES     YES   YES     NO


 Firefox 3.6+                   NO      NO    YES     YES


 Internet Explorer 9+           YES     YES    NO     YES


 Opera 10.5+                    NO      NO    YES     YES


 Safari 5+                      YES     YES    NO     YES
FUTURE OF WEB DESIGN NYC 2011




Audio
 <audio controls="controls">
  <source src="my.mp3"/>
  <source src="my.oga"/>
  <!-- fallback -->
 </audio>
FUTURE OF WEB DESIGN NYC 2011




Audio
 <audio controls="controls" autobuffer="autobuffer"
         preload="auto">
  <source src="my.mp3"/>
  <source src="my.oga"/>
  <!-- fallback -->
 </audio>
FUTURE OF WEB DESIGN NYC 2011




Audio
 <audio controls="controls" autobuffer="autobuffer"
         preload="auto">
  <source src="my.mp3"/>
  <source src="my.oga"/>
  <ul>
    <li><a href="my.mp3">Download MP3</a></li>
    <li><a href="my.oga">Download Ogg</a></li>
  </ul>
 </audio>
FUTURE OF WEB DESIGN NYC 2011




Audio
 <audio controls="controls" autobuffer="autobuffer"
         preload="auto">
  <source src="my.mp3"/>
  <source src="my.oga"/>
  <object …>
    <!-- flash player goes here -->
    <ul>
     <li><a href="my.mp3">Download MP3</a></li>
     <li><a href="my.oga">Download Ogg</a></li>
    </ul>
  </object>
 </audio>
FUTURE OF WEB DESIGN NYC 2011




Audio
 $('audio').each(function(){
    var $audio = $(this), media = {}, formats = [];
    $audio.find('source').each(function(){
      var src = $(this).attr('src'),
          ext = src.split('.').pop();
      media[ext] = src;
      formats.push(ext);
    });
     $audio.jPlayer({
      swfPath: '/vendors/jPlayer',
      ready:    function(){
        $audio.jPlayer('setMedia', media);
      },
      supplied: formats.join(', ')
    });
  });
                                                      Using jQuery & jPlayer
FUTURE OF WEB DESIGN NYC 2011




Audio
 $('audio').each(function(){
    var audio = this,
    $button = $('<button>Play</button>')
                .click(function(){
                   audio.play();
                 });
    $(this)
     .removeAttr('controls')
     .after($button);
  });
                                           Using jQuery
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Video
 <video src="my.ogv" controls="controls"></video>
FUTURE OF WEB DESIGN NYC 2011




    Video
    Video le = container le (like ZIP)
๏   1 video track
๏   1 (or more) audio tracks
๏   metadata

๏   subtitle/caption tracks (optional)




                                         141
FUTURE OF WEB DESIGN NYC 2011




    Video formats
๏   Flash Video (. v)
    Prior to 2008, the only video format supported in Adobe Flash.
๏   MPEG 4 (.m4v or .mp4)
    Based on QuickTime; iTunes uses this format.
๏   Ogg (.ogv)
    Open source container format.

๏   WebM (.webm)
    New format announced in May 2010.




                                                                     142
FUTURE OF WEB DESIGN NYC 2011




    Video codecs
๏   H.264
    Used primarily in MPEG 4. Only video codec natively supported on iOS.
    Patented.
๏   Theora
    Used primarily in Ogg. Royalty free. Supported in Firefox 3.5+ (in Ogg).
๏   VP8
    Used primarily in WebM. Owned by Google, but licensed royalty-free.




                                                                               143
FUTURE OF WEB DESIGN NYC 2011




    Audio codecs
๏   MP3
    Nearly universal in usage, but was part of FLV. Patented.
๏   AAC (Advanced Audio Coding)
    Used primarily in MP4. Patented.
๏   Vorbis
    Used in Ogg audio & video as well as WebM. Royalty-free.




                                                                144
FUTURE OF WEB DESIGN NYC 2011




Video
             Browser             .m4v               .ogv            .webm
                                (AAC + H.264)   (Vorbis + Theora)   (Vorbis + VP8)


 Chrome                            4-16               4+                 6+


 Firefox                            NO               3.5+                4+


 Internet Explorer                  9+                NO              MAYBE


 Opera                              NO               10.5+             10.6+


 Safari                            3.2+             MAYBE             MAYBE
FUTURE OF WEB DESIGN NYC 2011




No MIME, no service
 AddType video/ogg .ogv
 AddType video/mp4 .mp4
 AddType video/webm .webm
FUTURE OF WEB DESIGN NYC 2011




Video
 <video controls="controls" width="640" height="480">
  <source src="my.m4v"/>
  <source src="my.webm"/>
  <source src="my.ogv"/>
  <!-- fallback -->
 </video>
FUTURE OF WEB DESIGN NYC 2011




Video
 <video controls="controls" width="640" height="480"
         poster="my.png">
  <source src="my.m4v"/>
  <source src="my.webm"/>
  <source src="my.ogv"/>
  <!-- fallback -->
 </video>
FUTURE OF WEB DESIGN NYC 2011




Video
 <video controls="controls" width="640" height="480"
         poster="my.png">
  <source src="my.m4v"
            type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'/>
  <source src="my.webm"
            type='video/webm; codecs="vp8, vorbis"'/>
  <source src="my.ogv"
            type='video/ogg; codecs="theora, vorbis"'/>
  <!-- fallback -->
 </video>

Note: The MPEG 4 codec will depend on the encoding “profiles” you use.
FUTURE OF WEB DESIGN NYC 2011




Video
 <video width="600" height="400" poster="/r/2-5.png"
         controls="controls" preload="none">
  <source src="/r/2-5.m4v" type="video/mp4"/>
  <source src="/r/2-5.webm" type="video/webm"/>
  <source src="/r/2-5.ogv" type="video/ogg"/>
  <img src="/r/2-5.png" width="600" height="400" alt=""/>
  <ul>
    <li><a href="/r/2-5.m4v">Download as video/mp4</a></li>
    <li><a href="/r/2-5.webm">Download as video/webm</a></li>
    <li><a href="/r/2-5.ogv">Download as video/ogg</a></li>
  </ul>
 </video>
FUTURE OF WEB DESIGN NYC 2011




Video
 <video width="600" height="400" poster="/r/2-5.png"
        controls="controls" preload="none">
  <source src="/r/2-5.m4v" type="video/mp4"/>
  <source src="/r/2-5.webm" type="video/webm"/>
  <source src="/r/2-5.ogv" type="video/ogg"/>
  <object width="600" height="400"
          type="application/x-shockwave-flash"
          data="flowplayer-3.2.1.swf">
    <param name="movie" value="flowplayer-3.2.1.swf"/>
    <param name="allowfullscreen" value="true"/>
    <param name="flashvars" value='config={"clip": {"url":
            "/r/2-5.m4v", "autoPlay":false,
            "autoBuffering":true}}'/>
    <img src="/r/2-5.png" width="600" height="400" alt=""/>
    <ul><!-- links --></ul>
  </object>
 </video>
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Tools

                                RoadMovie
             Firefogg
FUTURE OF WEB DESIGN NYC 2011




RoadMovie
FUTURE OF WEB DESIGN NYC 2011




RoadMovie
FUTURE OF WEB DESIGN NYC 2011




RoadMovie
FUTURE OF WEB DESIGN NYC 2011




    Subtitle formats
๏   SubRip (.srt)
๏   SubViewer (.sub)
๏   SubStation Alpha (.ssa/.ass)
๏   MicroDVD




                                    157
FUTURE OF WEB DESIGN NYC 2011




    Subtitle formats
๏   SubRip (.srt)

     1
     00:01:31,041 --> 00:01:32,000
     Hello?

     2
     00:02:10,164 --> 00:02:12,082
     Good morning, is your mother in?




                                        158
FUTURE OF WEB DESIGN NYC 2011




    Subtitle formats
๏   SubViewer (.sub)

     00:01:31.04,00:01:32.00
     Hello?

     00:02:10.16,00:02:12.08
     Good morning, is your mother in?




                                        159
FUTURE OF WEB DESIGN NYC 2011




RoadMovie
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




FireFogg
FUTURE OF WEB DESIGN NYC 2011




Services
http://www.annodex.net/~silvia/itext/elephant_no_skin_v2.html
localStorage
FUTURE OF WEB DESIGN NYC 2011




localStorage
 if ( window.localStorage )
 {
   // Sweet!
 }
FUTURE OF WEB DESIGN NYC 2011




localStorage
 if ( window.localStorage )
 {
    var cache = window.localStorage;
    cache.setItem( 'test', 'I am storing nuts for the winter.' );
 }
FUTURE OF WEB DESIGN NYC 2011




localStorage
FUTURE OF WEB DESIGN NYC 2011




localStorage
 if ( window.localStorage )
 {
    var cache = window.localStorage;
    console.log( cache.getItem('test') );
 }
FUTURE OF WEB DESIGN NYC 2011




localStorage
 if ( window.localStorage )
 {
    var cache = window.localStorage;
    console.log( cache.getItem('test') );
    cache.clear();
    console.log( cache.getItem('test') );
 }
FUTURE OF WEB DESIGN NYC 2011




    localStorage
๏   is restricted by domain
๏   persists until deleted
    (programmatically or by the user)

๏   is limited in size (usually 5MB)
๏   is (currently) limited to strings




                                        175
FUTURE OF WEB DESIGN NYC 2011




    sessionStorage
๏   is like localStorage
๏   disappears when the browser is closed




                                            176
FUTURE OF WEB DESIGN NYC 2011




    localStorage
๏   is restricted by domain
๏   persists until deleted
    (programmatically or by the user)

๏   is limited in size (usually 5MB)
๏   is (currently) limited to strings




                                        177
FUTURE OF WEB DESIGN NYC 2011




Cue the sad trombone
 if ( window.localStorage )
 {
    var
    cache = window.localStorage,
    obj = {
     one: 1,
     two: 2
    };
    cache.setItem( 'nums', obj );
    console.log( cache.getItem( 'nums' ) );
 }
FUTURE OF WEB DESIGN NYC 2011




Huzzah!
 if ( window.localStorage )
 {
    var
    cache = window.localStorage,
    obj = {
     one: 1,
     two: 2
    };
    cache.setItem( 'nums', JSON.stringify( obj ) );
    console.log( JSON.parse( cache.getItem( 'nums' ) ) );
 }
FUTURE OF WEB DESIGN NYC 2011




    localStorage
๏   is restricted by domain
๏   persists until deleted
    (programmatically or by the user)

๏   is limited in size (usually 5MB)
๏   is (currently) limited to strings
๏   mutable




                                        180
FUTURE OF WEB DESIGN NYC 2011




Yikes!
 window.localStorage.setItem( ‘important’, ‘My locker combo is…’ );

 // …

 window.localStorage.setItem( ‘test’, ‘Just playing around’ );

 // …

 window.localStorage.clear();
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Play nicely in the sandbox
 // create a Squirrel instance with your unique key
 var $S = new Squirrel( 'scale-song' );

 // write a value to the cache
 $S.write( 'doe', 'ray' );

 // read it back
 $S.read( 'doe' ); // 'ray'

 // write a value to a sub-cache
 $S.write( 'song', 'doe', 'a dear, a female dear' );

 // read back the original value
 $S.read( 'doe' ); // 'ray'

 // read back the sub-cached value
 $S.read( 'song', 'doe' ); // 'a dear, a female dear'
                                   Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
FUTURE OF WEB DESIGN NYC 2011




Play nicely in the sandbox
 // removing a single property from the sub-cache
 $S.remove( 'song', 'doe' );

 // try to read the sub-cached value
 $S.read( 'song', 'doe' ); // null

 // read the root value
 $S.read( 'doe' ); // 'ray'
                                Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
FUTURE OF WEB DESIGN NYC 2011




Play nicely in the sandbox
 // add some more content to the sub-cache
 $S.write( 'song', 'doe', 'a dear, a female dear' );
 $S.write( 'song', 'ray', 'a drop of golden sun' );

 // clear the whole sub-cache
 $S.clear( 'song' );

 // check that it's been cleared
 $S.read( 'song', 'doe' ); // null
 $S.read( 'song', 'ray' ); // null

 // check that the root value's still intact
 $S.read( 'doe' ); // 'ray'
                                     Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
FUTURE OF WEB DESIGN NYC 2011




Play nicely in the sandbox
 // remove a property form the main cache
 $S.remove( 'doe' );

 // check it's value
 $S.read( 'doe' ); // null

 // write a bit more data in the root and in a sub-cache
 $S.write( 'doe', 'ray' );
 $S.write( 'song', 'doe', 'a dear, a female dear' );
 $S.write( 'song', 'ray', 'a drop of golden sun' );

 // clear the whole cache
 $S.clear();

 // check           it's all gone
 $S.read(           'song', 'doe' ); // null
 $S.read(           'song', 'ray' ); // null
 $S.read(           'doe' ); // null
                                               Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
indexedDB
  ~10+   ~4+   ~11+
FUTURE OF WEB DESIGN NYC 2011




indexedDB support
 if ( “indexedDB” in window ) {
   // Spec is final & implemented!
 }
 else if ( “mozIndexedDB” in window ) {
   // Mozilla is experimenting
 }
 else if ( “msIndexedDB” in window ) {
   // Microsoft is experimenting
 }
 else if ( “webkitIndexedDB” in window ) {
   // Chrome is experimenting
 }
 else {
   // no dice
 }
FUTURE OF WEB DESIGN NYC 2011




indexedDB

                                Kids                 Candy




                                       Candy Sales
FUTURE OF WEB DESIGN NYC 2011




indexedDB
 var request = window.indexedDB.open(
   "CandyDB", "My candy store database"
 );
FUTURE OF WEB DESIGN NYC 2011




indexedDB: initialization
 request.onsuccess = function(event) {
   var db = event.result;
   if ( db.version != "1" )
   {
     // Initialize database
     var createdObjectStoreCount = 0,
     objectStores = [ { name: "kids", keyPath: "id", autoIncrement: true },
                       { name: "candy", keyPath: "id", autoIncrement: true },
                       { name: "candySales", keyPath: "", autoIncrement: true } ],
     len = objectStores.length, params;
  
     while ( len-- ) {
       var params = objectStores[len];
       request = db.createObjectStore(
         params.name, params.keyPath, params.autoIncrement
       );
       request.onsuccess = objectStoreCreated;
     }
   }
   else {
     // User has been here before, no initialization required.
     loadData(db);
   }
 };
FUTURE OF WEB DESIGN NYC 2011




indexedDB: initialization
 function objectStoreCreated(event) {
   if ( ++createdObjectStoreCount == objectStores.length )
   {
      db.setVersion("1").onsuccess = function(event) {
        loadData(db);
      };
   }
 }
FUTURE OF WEB DESIGN NYC 2011




indexedDB: create
 var kids = [ { name: "Anna" }, { name: "Betty" },
              { name: "Christine" } ];

 var request = window.indexedDB.open(
   "CandyDB", "My candy store database"
 );
 request.onsuccess = function(e) {
   var objectStore = e.result.objectStore("kids"),
   var i=0, len=kids.length;
   while ( i < len ) {
     var kid = kids[i++];
     objectStore.add(kid).onsuccess = function(e) {
      console.log( "Saved record for " + kid.name +
                     " with id " + e.result );
     };
   }
 };
FUTURE OF WEB DESIGN NYC 2011




indexedDB: read
 request.onsuccess = function(e) {
  // Enumerate the entire object store.
  request = e.result.objectStore("kids").openCursor();
  request.onsuccess = function( event )
  {
    var cursor = event.result;
    // If cursor is null … done
    if (!cursor) { return; }
    console.log( cursor.value.name );
    cursor.continue();
  };
 };
FUTURE OF WEB DESIGN NYC 2011




indexedDB: read w/ join
 var candyEaters = [];
 request.onsuccess = function(event) {
   var db = event.result,
   transaction = db.transaction(["kids", "candySales"]);
   transaction.oncomplete = function(){ console.log(candyEaters); },
   kidCursor, saleCursor, salesLoaded=false, count;
  
   var kidsStore = transaction.objectStore("kids");
   kidsStore.openCursor().onsuccess = function(event) {
     kidCursor = event.result;
     count = 0;
     attemptWalk();
   }

    var salesStore = transaction.objectStore("candySales");
    var kidIndex = salesStore.index("kidId");
    kidIndex.openObjectCursor().onsuccess = function(event) {
      saleCursor = event.result;
      salesLoaded = true;
      attemptWalk();
    }

    //…
FUTURE OF WEB DESIGN NYC 2011




indexedDB: read w/ join
     // …

     function attemptWalk() {
       if (!kidCursor || !salesLoaded) return;
  
         if ( saleCursor && kidCursor.value.id == saleCursor.kidId )
         {
           count++;
           saleCursor.continue();
         }
         else
         {
           candyEaters.push({ name: kidCursor.value.name, count: count });
           kidCursor.continue();
         }
     }

 } // end request.onsuccess
Alternatives
FUTURE OF WEB DESIGN NYC 2011




    DB Alternatives
๏   LocalStorageDB
    https://github.com/easy-designs/LocalStorageDB.js
๏   localStorageDB
    https://github.com/knadh/localStorageDB




                                                        198
FUTURE OF WEB DESIGN NYC 2011




LocalStorageDB example
 // init
 var DB = new LocalStorageDB('my_first_database');

 // Table Creation
 DB.CREATE( 'my_first_table', { id: 0, foo: 'bar', test: 'ing' } );

 // Insert
 DB.INSERT_INTO( 'my_first_table', [{test:'ed'},{foo:'bat'}] );

 // Read
 DB.SELECT( 'my_first_table' ); // [{id:0,foo:'bar',test:'ed'}, {id:1,foo:'bat',test:'ing'}]
 DB.SELECT( 'my_first_table', {foo:'bar'} ); // [{id:0,foo:'bar',test:'ed'}]

 // Update
 DB.UPDATE( 'my_first_table', {test:'nada'}, {foo:'bar'} );
 DB.SELECT( 'my_first_table', {foo:'bar'} ); // [{id:0,foo:'bar',test:'nada'}]

 // Delete
 DB.DELETE( 'my_first_table', {foo:'bar'} );
 DB.SELECT( 'my_first_table', {foo:'bar'} ); // []
FUTURE OF WEB DESIGN NYC 2011




LocalStorageDB example
 this.searchArticles = function( q, callback ) {
   var cat_ids = [], categories = [],
   articles = _DB.SELECT( 'articles', function( row ){
                  var $div = $('<div/>').html( row.html );
                  if ( row.title.indexOf( q ) > -1 ||
                       $div.text().indexOf( q ) > -1 ) {
                    row.type = 'article';
                    cat_ids.push( row.category_id );
                    return true;
                  }
                  return false;
                }).LIMIT(6),
   i = articles.length;
  _DB.SELECT( 'categories', function( row ){
     var i = $.inArray( row.id, cat_ids );
     if ( i > -1 ) {
       categories[cat_ids[i]] = row.slug;
     }
     return false;
   });
  while ( i-- ) {
       articles[i].category_slug = categories[articles[i].category_id];
   }
   if ( callback instanceof Function ) { callback( articles ); }
 };
FUTURE OF WEB DESIGN NYC 2011




localStorageDB example
 // Initialise. If the database doesn't exist, it is created
 var lib = new localStorageDB( "library" );

 // Check if the database was just created. Useful for initial database setup
 if ( lib.isNew() ) {

      // create the "books" table
      lib.createTable( "books", ["id", "title", "author", "year", "copies"] );

      // insert some data
      lib.insert( "books",
                  { id: "B001", title: "Phantoms in the brain",
                    author: "Ramachandran", year: 1999, copies: 10 } );

      // commit the database to localStorage
      // all create/drop/insert/update/delete operations should be committed
      lib.commit();

 }
Geolocation
9+   3.5+   5+   5+   10.6+
FUTURE OF WEB DESIGN NYC 2011




Geolocation
 if ( navigator.geolocation )
 {
   navigator.geolocation.getCurrentPosition(
     function(position){
       var lat = position.coords.latitude;
       var lon = position.coords.longitude;
     },
     function(error){
       alert('ouch');
     }
   );
 }
FUTURE OF WEB DESIGN NYC 2011




Geolocation
 function getPlaceFromFlickr( lat, lon, callback )
 {
   // the YQL statement
   var yql = 'select * from flickr.places where lat=' +
             lat + ' and lon=' + lon;

    // assembling the YQL webservice API
    var url = 'http://query.yahooapis.com/v1/public/yql?q=' +
              encodeURIComponent(yql) +
              '&format=json&diagnostics=false&callback=' + callback;

  // create a new script node and add it to the document
  var s = document.createElement('script');
  s.setAttribute( 'src', url );
  document.getElementsByTagName('head')[0].appendChild(s);
 };

 // …
FUTURE OF WEB DESIGN NYC 2011




Geolocation
 // callback in case there is a place found
 function output(o){
   if ( typeof(o.query.results.places.place) != 'undefined' )
   {
     console.log( o.query.results.places.place.name );
   }
 }
FUTURE OF WEB DESIGN NYC 2011




Geolocation
 if ( navigator.geolocation )
 {
   navigator.geolocation.getCurrentPosition(
     function(position){
       getPlaceFromFlickr(
         position.coords.latitude,
         position.coords.longitude,
         'output'
       );
     },
     function(error){
       alert('ouch');
     }
   );
 }
Offline
10+   3.5+   4+   4+   10.6+
FUTURE OF WEB DESIGN NYC 2011




Offline
 <html manifest="manifest.appcache">
FUTURE OF WEB DESIGN NYC 2011




Offline
 CACHE MANIFEST
 # Cache manifest version 1.0
 # Change the version number to trigger an update

 CACHE:
 index.php
 c/main.css
 j/main.js
 i/logo.png

 # when offline, change content
 FALLBACK:
 / /offline.html

 # never cached
 NETWORK:
 signup.html
                                  manifest.appcache   served with MIME of text/cache-manifest
FUTURE OF WEB DESIGN NYC 2011




Offline
 navigator.onLine // true or false
FUTURE OF WEB DESIGN NYC 2011




    Limits
๏   Safari (desktop): ∞

๏   Safari (iOS): 10MB

๏   Chrome: 5MB*

๏   Android: ∞

๏   Firefox: ∞**

๏   Opera: 50MB***




                                    * Installed “Apps” get more
                                    ** Permission required
                                    *** User-adjustable


                                                            211
Lunch!
HTML5 & CSS3 Workshop [FoWD NYC 2011]
FUTURE OF WEB DESIGN NYC 2011




Parsing errors


                                p{
                                  color: red;
                                }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors


                                p{
                                  color: red;
                                }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors


                                p{
                                  color: red;
                                  font-weight: bold;
                                }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors


                                p{
                                  color: red;
                                  font-weight: bold;
                                }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors
 p {
   color: #ccc;
   color: rgba( 0, 0, 0, .5 );
 }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors
 html[lang] p {
   color: #ccc;
   color: rgba( 0, 0, 0, .5 );
 }
FUTURE OF WEB DESIGN NYC 2011




Parsing errors
 @-moz-document url-prefix() {
   html[lang] p {
     color: #ccc;
     color: rgba( 0, 0, 0, .5 );
   }
 }
#intro {
  /* Basic Layout */
}

/* ... */

body[id=css-zen-garden] #intro {
 /* Advanced Layout */
}
#intro {
  /* Basic Layout */
}

/* ... */

[foo], #intro {
  /* Advanced Layout */
}
FUTURE OF WEB DESIGN NYC 2011




Parsing errors
 @import 'not-for-IE7-or-below.css' screen;

 @media screen, print, refrigerator {
   /* IE will get these rules */
 }
FUTURE OF WEB DESIGN NYC 2011




Organization



                                design
FUTURE OF WEB DESIGN NYC 2011




Organization
FUTURE OF WEB DESIGN NYC 2011




Organization
FUTURE OF WEB DESIGN NYC 2011




Organization


                                type        color


                                   layout
FUTURE OF WEB DESIGN NYC 2011




Organization
 /* =Typography */
 img {
   display: block;
 }

 /* =Layout */
 @media screen {
   .frame .inner {
     border: 10px solid;
   }
 }

 /* =Color */
 .frame .inner {
   background-color: rgb(227, 222, 215);
   border-color: rgb(227, 222, 215);
 }
FUTURE OF WEB DESIGN NYC 2011




Organization

                    type.css




                  layout.css




                   color.css
FUTURE OF WEB DESIGN NYC 2011




Organization

                    type.css




                  layout.css    main.css




                   color.css
FUTURE OF WEB DESIGN NYC 2011




Organization
 {embed="styles/typography"}

 @media screen {
   {embed="styles/layout-screen"}
 }

 {embed="styles/color"}
FUTURE OF WEB DESIGN NYC 2011




Organization
 {embed="styles/reset"}

 {embed="styles/typography"}

 @media screen {
   {embed="styles/layout-screen"}
 }

 @media print {
   {embed="styles/layout-print"}
 }

 {embed="styles/color"}

 {embed="styles/effects"}
FUTURE OF WEB DESIGN NYC 2011




Monkey-patching
 <link rel="stylesheet" href="main.css"/>
 <!--[if IE 9]><link rel="stylesheet" href="ie9.css"/><![endif]-->
 <!--[if lte IE 8]><link rel="stylesheet" href="ie8.css"/><![endif]-->
 <!--[if lte IE 7]><link rel="stylesheet" href="ie7.css"/><![endif]-->
 <!--[if lte IE 6]><link rel="stylesheet" href="ie6.css"/><![endif]-->
FUTURE OF WEB DESIGN NYC 2011




Monkey-patching
 @-moz-document url-prefix() {

       /* GENERATED CONTENT - FF3 doesn't allow positioning */
       #extra-mile:before {
          content: '';
       }
       #extra-mile:first-of-type:before {
          content: url(extra-mile-sign.png);
       }

 }
Selectors
9+    3.5+   4+   3.2+   9.5+
FUTURE OF WEB DESIGN NYC 2011




Selectors: attribute
 /* Basic */
 [lang] { outline: 1px solid red; }

 /* Value */
 [title=Search] { outline: 1px solid blue; }

 /* Space-separated */
 [title ~=go] { outline: 1px solid green; }

 /* starts hyphenated */
 [id|=fb] { height:200px; background: red; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: attribute
 /* Starts */
 [title^=Click] { outline: 10px solid purple; }

 /* Ends */
 [title$=article] { outline: 1px solid orange; }

 /* Contains */
 [title*=g] { color: red; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 /* First or last */
 p:first-child
 p:last-child

 /* First or last of a specific type */
 p:first-of-type
 p:last-of-type

 /* One is the loneliest number */
 p:only-child
 p:only-of-type

 /* Nature abhors a vacuum */
 p:empty
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 /* Specific elements */
 p:nth-child(1)
 p:nth-child(5)

 /* All paragraphs */
 p:nth-child(1n+0)
 p:nth-child(n+0)
 p:nth-child(n)
 /* Same as a simple element selector, but more specific */
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 /* Stripey! */
 :nth-child(odd) { background: white; }
 :nth-child(even) { background: grey; }

 /* Stripey! */
 :nth-child(2n+1) { background: white; }
 :nth-child(2n+0) { background: grey; }

 /* Alternate paragraph colours in CSS */
 p:nth-child(4n+1) { color: navy; }
 p:nth-child(4n+2) { color: green; }
 p:nth-child(4n+3) { color: maroon; }
 p:nth-child(4n+4) { color: purple; }

 /* 9th, 19th, 29th… */
 p:nth-child(10n-1) { color: navy; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 /* Only paragraph elements considered */
 p:nth-of-type(odd) { background: white; }
 p:nth-of-type(even) { background: grey; }

 /* Every paragraph but first and last */
 p:nth-of-type(n+2):nth-last-of-type(n+2) { background: white; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 /* Negatory good buddy */
 p:not(:empty) { outline: 10px solid red; }
 p:not(:visited) { color: blue; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo class
 :enabled
 :disabled

 :checked

 :required
 :optional

 :valid
 :invalid

 :in-range
 :out-of-range

 :read-only
 :read-write
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo element
 /* Dynamics */
 p::first-letter {
   font-size: 2.8em;
   float: left;
   line-height: 1;
   margin-right: .1em;
 }
 p::first-line { font-weight: bold; }
FUTURE OF WEB DESIGN NYC 2011




Selectors: pseudo element
 /* Generated content */
 p::before { content: ‘hello from CSS’; }
 p::after { content: ‘goodbye from CSS’; }


 a::after { content: url(http://graphics8.nytimes.com/images/
 multimedia/icons/document_icon.gif); }
Media Queries
 9+   3.5+   4+   4+   9.5+
FUTURE OF WEB DESIGN NYC 2011




@media blocks
 @media screen {
   /* Styles for screen media only */
 }
FUTURE OF WEB DESIGN NYC 2011




@media blocks+
 @media screen and (max-width:450px) {
   /* Styles for screen media when browser
      is 450px wide or below */
 }
FUTURE OF WEB DESIGN NYC 2011




Getting granular
 @media
   screen and (min-device-width:1024px)
          and (max-width:989px),
   screen and (max-device-width:480px),
   screen and (max-device-width:480px)
          and (orientation:landscape),
   screen and (min-device-width:481px)
          and (orientation:portrait) {
   /* Layout for narrower desktop (below 990px)
      or
      iPhone running iOS 3 (or equivalent)
      or
      iPhone running iOS 4 (or equivalent) in “landscape” view
      or
      iPad (or equivalent) in “portrait” view */
 }
FUTURE OF WEB DESIGN NYC 2011




Mobile First w/ media queries
 /* Universal Layout */

 @media screen {
   /* Styles for all screens */
 }

 @media screen and (min-width:481px) {
   /* Styles for all screens 480px+ width */
 }

 @media screen and (min-width:754px) {
   /* Styles for all screens 754px+ width */
 }
FUTURE OF WEB DESIGN NYC 2011




Patching IE8-
 @media screen and (min-width:480px) {
   /* styles for 480px and up go here */
 }
                                                                         main.css


 <link rel=”stylesheet” href=”main.css”/>
 <script src=”respond.min.js”></script>
                                                                       index.html




                                https://github.com/scottjehl/Respond
Colors
9+   3+   4+   3.1+   10+
FUTURE OF WEB DESIGN NYC 2011




Colors: keywords
 p {
   color: red;
 }
FUTURE OF WEB DESIGN NYC 2011




Colors: hexadecimal
 p {
   color: #f00;
 }
FUTURE OF WEB DESIGN NYC 2011




Colors: RGB
 p {
   color: rgb( 255, 0, 0 );
 }
FUTURE OF WEB DESIGN NYC 2011




Colors: HSL
 p {
   color: #f00;
   color: hsl( 0, 100%, 50% );
 }
FUTURE OF WEB DESIGN NYC 2011




Colors: HSLa
 p {
   color: #F99;
   color: hsla( 0, 100%, 50%, .5 );
 }
FUTURE OF WEB DESIGN NYC 2011




Colors: RGBa
 p {
   color: #F99;
   color: rgba( 255, 0, 0, .5 );
 }
Backgrounds
 9+   4+   4+   5+   10.5+
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                         9+   3.6+   4+   5+   10+




 p {
   background: url(first.png),
               url(second.png),
               url(third.png);
   background-position: top left;
   background-repeat: no-repeat;
 }
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                        9+   3.6+   4+   5+   10+




 p {
   background: url(first.png) right bottom,
               url(second.png) center center,
               #fff url(third.png) bottom right;
   background-repeat: no-repeat;
 }
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                                      9+     4+    4+    5+    11+




 p {
   background: red;
   background-clip: border-box; /* or padding|content-box */
   border: 10px dashed;
   padding: 10px;
 }

                                FF 1-3.6 requires -moz- and doesn’t accept the “-box” portion
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+   4+   4+   5+   11+




 p {
   background: url(image-1.png), red url(image-2.png);
   background-clip: border-box, content-box;
   border: 10px dashed;
   padding: 10px;
 }
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                                    9+     4+    4+    5+    11+




 p {
   background: url(image-1.png);
   background-origin: border-box; /* or padding|content-box */
   border: 10px dashed;
   padding: 10px;
 }

                                FF 3.6 requires -moz- and doesn’t accept the “-box” portion
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+     4+    4+    5+   10.5+




 p {
   background: url(image-1.png), url(image-2.png);
   background-size: 100px 50px, auto;
   border: 10px dashed;
   padding: 10px;
 }

                                                     FF 3.6 requires -moz-
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+     4+    4+    5+   10.5+




 p {
   background: url(image-1.png), url(image-2.png);
   background-size: cover;
   border: 10px dashed;
   padding: 10px;
 }

                                                     FF 3.6 requires -moz-
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+     4+    4+    5+   10.5+




 p {
   background: url(image-1.png), url(image-2.png);
   background-size: contain;
   border: 10px dashed;
   padding: 10px;
 }

                                                     FF 3.6 requires -moz-
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+                      10.5+




 p {
   background: url(image-1.png), url(image-2.png);
   background-repeat: space;
   border: 10px dashed;
   padding: 10px;
 }

                                                     FF 3.6 requires -moz-
FUTURE OF WEB DESIGN NYC 2011




Backgrounds                                    9+                      10.5+




 p {
   background: url(image-1.png), url(image-2.png);
   background-repeat: round;
   border: 10px dashed;
   padding: 10px;
 }

                                                     FF 3.6 requires -moz-
Gradients
10+   3.6+   4+   4+   11+
FUTURE OF WEB DESIGN NYC 2011




Gradients
 p {
   background: #1e5799; /* Old browsers */
   background: -moz-linear-gradient( top, #1e5799 0%, #2989d8 50%,
                                      #207cca 51%, #7db9e8 100% ); /* FF3.6+ */
   background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799),
                                 color-stop(50%,#2989d8), color-stop(51%,#207cca),
                                 color-stop(100%,#7db9e8) ); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%,
                                         #7db9e8 100% ); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%,
                                   #7db9e8 100% ); /* Opera 11.10+ */
   background: -ms-linear-gradient( top, #1e5799 0%,#2989d8 50%,#207cca 51%,
                                     #7db9e8 100%); /* IE10+ */
   background: linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%,
                                #7db9e8 100% ); /* W3C */
 }
http://www.colorzilla.com/gradient-editor/
Box Shadow
9+   ~3.5+   ~4+   ~3.1+   10.5+
FUTURE OF WEB DESIGN NYC 2011




Box shadow
 p {
   box-shadow: -5px             /* Horizontal offset */
               5px              /* Vertical offset */
               15px             /* Blur radius (optional) */
               7px              /* Spread distance (optional) */
               #fff;            /* Color */
 }
FUTURE OF WEB DESIGN NYC 2011




Box shadow
 p {
   box-shadow: inset            /*   Horizontal offset (optional) */
               -5px             /*   Horizontal offset */
               5px              /*   Vertical offset */
               15px             /*   Blur radius (optional) */
               7px              /*   Spread distance (optional) */
               #000;            /*   Color */
 }
http://webstandardssherpa.com/
http://webstandardssherpa.com/
FUTURE OF WEB DESIGN NYC 2011




Box shadow
 p {
   box-shadow: -5px 5px 15px 7px #fff,
               5px -5px 15px 7px #f00;
 }
Text Shadow
10+   ~3.5+   ~4+   ~4+   9.5+
FUTURE OF WEB DESIGN NYC 2011




Text shadow
 p {
   text-shadow: -5px            /*   Horizontal offset */
                5px             /*   Vertical offset */
                15px            /*   Blur radius (optional) */
                #fff;           /*   Color */
 }
FUTURE OF WEB DESIGN NYC 2011




Text shadow
 p {
   text-shadow: 5px 0px 0px #F5602A,
                10px 0px 0px #EDB037,
                15px 0px 0px #EBF21F,
                20px 0px 0px #71F723,
                25px 0px 0px #20EEF5,
                30px 0px 0px #3019FF,
                35px 0px 0px #DB20E8;
 }
Bio-Break!
Border Images
 10?   ~3.5+   ~4+   ~3.21+   ~10.5+
FUTURE OF WEB DESIGN NYC 2011




Border images
 p {
   border-image: url(border.png)    /* Horizontal offset */
                 27 /               /* Vertical offset */
                 round              /* Blur radius (optional) */
                 stretch;           /* Color */
 }




                                   Blah blah blah blah. Blah
                                   blah blah blah. Blah blah
                                   blah blah blah.
http://border-image.com/
Box Sizing
8+   ~2+   ~4+   ~3.1+   ~9.5+
FUTURE OF WEB DESIGN NYC 2011




Box sizing
 p.one {
   box-sizing: content-box; /* Standards Mode */
 }


 p.two {
   box-sizing: border-box; /* Like Quirks Mode */
 }




                                                    Content Box

5px

                                                    Border Box


                                200px
Transitions
~10+   ~4+   ~4+   ~3.1+   ~10.5+
FUTURE OF WEB DESIGN NYC 2011




Transitions
 a {
   transition: color            /* Property */
               2s               /* Duration */
               linear           /* Function (optional) */
               0.5s;            /* Delay (optional) */
 }
FUTURE OF WEB DESIGN NYC 2011




Transitions
 a {
  transition-property:           color,
                                 font-size;
     transition-duration:        .5s;
     transition-timing-function: ease-in-out,
                                 linear;
 }
2D Transformations
    ~9+   ~3.5+   ~4+   ~3.1+   ~10.5+
FUTURE OF WEB DESIGN NYC 2011




Transformations
 p {
   transform: rotate(45deg);
   transform-origin: 50% 50%
 }




                                         t
                                         es
                                       at
                                  is
                                  is
                                Th
FUTURE OF WEB DESIGN NYC 2011




Transformations
 p {
   transform: rotate(15deg)
              scale(.5)
              translateX(20px)
              translateY(-20px);
 }
FUTURE OF WEB DESIGN NYC 2011




    Transformation functions
๏   scale, scaleX, scaleY
๏   skew, skewX, skewY
๏   translate, translateX, translateY




                                        288
Animations
~10+   ~5+   ~4+   ~4+   12?
FUTURE OF WEB DESIGN NYC 2011




Animations
 @keyframes thisIsMyAnimation {
   0% { top: 0px; }
   33% {
     top: 50px;
     animation-timing-function: ease-out
   }
   100% { top: 100px; left: 10px; }
 }


 p {
   animation: thisIsMyAnimation   /* Animation Function */
              4s                  /* Duration */
              linear              /* Timing Function */
              1.5s                /* Delay */
              infinite            /* Iterations */
              alternate           /* Reverse? */
              none;               /* Fill mode */
 }
FUTURE OF WEB DESIGN NYC 2011




Animations
 p {
   animation: grow 4s linear,
              shimmy 2s ease-in-out;
 }

More Related Content

PDF
HTML5: Smart Markup for Smarter Websites [Future of Web Apps, Las Vegas 2011]
PDF
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
PPTX
HTML5 and Search Engine Optimization (SEO)
PDF
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
PPTX
Getting Started with HTML5 in Tech Com (STC 2012)
PDF
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
PDF
HTML5 Introduction
PDF
The Future of the Web: HTML5
HTML5: Smart Markup for Smarter Websites [Future of Web Apps, Las Vegas 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 and Search Engine Optimization (SEO)
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
Getting Started with HTML5 in Tech Com (STC 2012)
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
HTML5 Introduction
The Future of the Web: HTML5

What's hot (19)

PDF
Up to Speed on HTML 5 and CSS 3
PPT
HTML 5 Overview
PPTX
HTML5: The Next Internet Goldrush
ODP
PPTX
HTML5 introduction for beginners
PDF
Basics of css and xhtml
PPTX
Html5 tutorial for beginners
PDF
Wordcamp Thessaloniki 2011 The Nextweb
PPTX
Html 5 tutorial - By Bally Chohan
PDF
Word camp nextweb
PDF
HTML5--The 30,000' View (A fast-paced overview of HTML5)
PPTX
HTML5: a quick overview
PDF
Intro to html 5
PDF
Introduction to HTML5
PPTX
HTML5 Tutorial
PPT
HTML5 Mullet: Forms & Input Validation
PPTX
SharePoint 2010 Web Standards & Accessibility
PPTX
Html 5
PDF
HTML5: features with examples
Up to Speed on HTML 5 and CSS 3
HTML 5 Overview
HTML5: The Next Internet Goldrush
HTML5 introduction for beginners
Basics of css and xhtml
Html5 tutorial for beginners
Wordcamp Thessaloniki 2011 The Nextweb
Html 5 tutorial - By Bally Chohan
Word camp nextweb
HTML5--The 30,000' View (A fast-paced overview of HTML5)
HTML5: a quick overview
Intro to html 5
Introduction to HTML5
HTML5 Tutorial
HTML5 Mullet: Forms & Input Validation
SharePoint 2010 Web Standards & Accessibility
Html 5
HTML5: features with examples
Ad

Similar to HTML5 & CSS3 Workshop [FoWD NYC 2011] (20)

PDF
Adaptive Web Design Workshop [inspire 2011]
PDF
Adaptive Web Design Workshop [Iceweb 2011]
PDF
Adaptive Web Design Workshop [WebVisions NYC 2012]
PDF
Adaptive Web Design [WebVisions Portland 2012]
PDF
HTML5: The New html for the web
PPT
HTML 5 Complete Reference
PDF
HTML5, just another presentation :)
ODP
Light introduction to HTML
PPTX
DOCX
Report html5
PDF
Html5 training
ZIP
Html5 public
PDF
HTML5 - An introduction
PDF
Intro to HTML 5 / CSS 3
PPTX
Chapter 2 introduction to html5
ODP
Html5 101
PDF
PDF
Html5 101
Adaptive Web Design Workshop [inspire 2011]
Adaptive Web Design Workshop [Iceweb 2011]
Adaptive Web Design Workshop [WebVisions NYC 2012]
Adaptive Web Design [WebVisions Portland 2012]
HTML5: The New html for the web
HTML 5 Complete Reference
HTML5, just another presentation :)
Light introduction to HTML
Report html5
Html5 training
Html5 public
HTML5 - An introduction
Intro to HTML 5 / CSS 3
Chapter 2 introduction to html5
Html5 101
Html5 101
Ad

More from Aaron Gustafson (20)

PDF
Delivering Critical Information and Services [JavaScript & Friends 2021]
PDF
Adapting to Reality [Guest Lecture, March 2021]
PDF
Designing the Conversation [Beyond Tellerrand 2019]
PPTX
Getting Started with Progressive Web Apps [Beyond Tellerrand 2019]
PDF
Progressive Web Apps: Where Do I Begin?
PDF
Media in the Age of PWAs [ImageCon 2019]
PDF
Adapting to Reality [Starbucks Lunch & Learn]
PDF
Conversational Semantics for the Web [CascadiaJS 2018]
PDF
Better Performance === Greater Accessibility [Inclusive Design 24 2018]
PDF
PWA: Where Do I Begin? [Microsoft Ignite 2018]
PDF
Designing the Conversation [Concatenate 2018]
PDF
Designing the Conversation [Accessibility DC 2018]
PDF
Performance as User Experience [AEADC 2018]
PDF
The Web Should Just Work for Everyone
PDF
Performance as User Experience [AEA SEA 2018]
PDF
Performance as User Experience [An Event Apart Denver 2017]
PDF
Advanced Design Methods 1, Day 2
PDF
Advanced Design Methods 1, Day 1
PDF
Designing the Conversation [Paris Web 2017]
PDF
Exploring Adaptive Interfaces [Generate 2017]
Delivering Critical Information and Services [JavaScript & Friends 2021]
Adapting to Reality [Guest Lecture, March 2021]
Designing the Conversation [Beyond Tellerrand 2019]
Getting Started with Progressive Web Apps [Beyond Tellerrand 2019]
Progressive Web Apps: Where Do I Begin?
Media in the Age of PWAs [ImageCon 2019]
Adapting to Reality [Starbucks Lunch & Learn]
Conversational Semantics for the Web [CascadiaJS 2018]
Better Performance === Greater Accessibility [Inclusive Design 24 2018]
PWA: Where Do I Begin? [Microsoft Ignite 2018]
Designing the Conversation [Concatenate 2018]
Designing the Conversation [Accessibility DC 2018]
Performance as User Experience [AEADC 2018]
The Web Should Just Work for Everyone
Performance as User Experience [AEA SEA 2018]
Performance as User Experience [An Event Apart Denver 2017]
Advanced Design Methods 1, Day 2
Advanced Design Methods 1, Day 1
Designing the Conversation [Paris Web 2017]
Exploring Adaptive Interfaces [Generate 2017]

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
Machine learning based COVID-19 study performance prediction
Understanding_Digital_Forensics_Presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Spectroscopy.pptx food analysis technology
Approach and Philosophy of On baking technology

HTML5 & CSS3 Workshop [FoWD NYC 2011]

  • 2. You are already using HTML5
  • 3. FUTURE OF WEB DESIGN NYC 2011 HTML 4.01 html meta head link style title base body dl dt dd bdo script noscript map dfn b object param p div ul ol li cite iframe address area img br a i small pre code abbr kbd var q samp hr menu textarea ins del sub sup span strong select option optgroup label input form fieldset legend button u em blockquote h1 h2 h3 h4 h5 h6 table caption col colgroup thead tbody tfoot tr th td
  • 4. FUTURE OF WEB DESIGN NYC 2011 HTML5 html meta head link style title base body dl dt dd section article bdo script noscript map dfn b aside details summary object param p div ul ol li cite canvas audio video iframe address area img br a i small nav figure figcaption pre code abbr kbd var q samp hr menu header footer command textarea ins del sub sup span strong time source datalist select option optgroup label input output ruby progress form fieldset legend button u em mark hgroup meter blockquote h1 h2 h3 h4 h5 h6 wbr keygen embed table caption col colgroup rt rp thead tbody tfoot tr th td
  • 5. FUTURE OF WEB DESIGN NYC 2011 Our focus today html meta head link style title base body dl dt dd section article bdo script noscript map dfn b aside details summary object param p div ul ol li cite canvas audio video iframe address area img br a i small nav figure figcaption pre code abbr kbd var q samp hr menu header footer command textarea ins del sub sup span strong time source datalist select option optgroup label input output ruby progress form fieldset legend button u em mark hgroup meter blockquote h1 h2 h3 h4 h5 h6 wbr keygen embed table caption col colgroup rt rp thead tbody tfoot tr th td
  • 6. What’s the easiest way to “switch” a site to HTML5?
  • 7. FUTURE OF WEB DESIGN NYC 2011 Fault tolerance <!DOCTYPE html>
  • 9. FUTURE OF WEB DESIGN NYC 2011 Simpli cation <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html lang="en">
  • 10. FUTURE OF WEB DESIGN NYC 2011 Simpli cation <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta charset="utf-8" />
  • 11. FUTURE OF WEB DESIGN NYC 2011 Simpli cation <link rel="stylesheet" href="style-original.css" type="text/css" /> <style type=”text/css”> /* … */ </style> <script type=”text/javascript” src=”myscript.js”></script> <link rel="stylesheet" href="style-original.css" /> <style> /* … */ </style> <script src=”myscript.js”></script>
  • 12. Organization 9+ 4+ 6+ 5+ 11.1+
  • 13. FUTURE OF WEB DESIGN NYC 2011 Organization <section> <!-- pretty much anything can go here --> </section> <article> <!-- pretty much anything can go here --> </article>
  • 20. FUTURE OF WEB DESIGN NYC 2011 Organization <header> <!-- titles, etc. go here --> </header> <footer> <!-- meta/supplementary information goes here --> </footer>
  • 29. FUTURE OF WEB DESIGN NYC 2011 Organization <nav> <ol> <li><a href="#details">Details</a></li> <li><a href="#lodging">Lodging</a></li> <li><a href="#location">Location</a></li> <li><a href="#topics">Topics</a></li> <li><a href="#contact">Contact Us</a></li> </ol> <p><a href="register">Register Now</a> <b>Only 5 spaces left</b></p> </nav>
  • 31. nav
  • 33. nav
  • 34. FUTURE OF WEB DESIGN NYC 2011 Organization <article> <!-- main content --> <aside> <!-- something related --> </aside> </article>
  • 36. aside
  • 45. FUTURE OF WEB DESIGN NYC 2011 Implicit sections (HTML 4) <h1> HTML5 <p> HTML5 is currently under development... <p> Like its immediate predecessors, HTML... <h2> W3C standardization process <p> The Web Hypertext Application... <p> The HTML5 specification... <p> According to the W3C timetable... <p> Ian Hickson, editor of the HTML5... <h2> Markup <p> HTML5 introduces a number of... <p> The HTML5 syntax is no longer... 1 HTML5 1.1 W3C standardization process 1.2 Markup
  • 46. FUTURE OF WEB DESIGN NYC 2011 Explicit sections (HTML5) <h1> HTML5 <p> HTML5 is currently under development... <p> Like its immediate predecessors, HTML... <h2> W3C standardization process section <p> The Web Hypertext Application... <p> The HTML5 specification... <p> According to the W3C timetable... <p> Ian Hickson, editor of the HTML5... <h2> Markup section <p> HTML5 introduces a number of... <p> The HTML5 syntax is no longer... 1 HTML5 1.1 W3C standardization process 1.2 Markup
  • 47. FUTURE OF WEB DESIGN NYC 2011 Explicit sections (HTML5) <h1> HTML5 <p> HTML5 is currently under development... <p> Like its immediate predecessors, HTML... <h1> W3C standardization process section <p> The Web Hypertext Application... <p> The HTML5 specification... <p> According to the W3C timetable... <p> Ian Hickson, editor of the HTML5... <h1> Markup section <p> HTML5 introduces a number of... <p> The HTML5 syntax is no longer... 1 HTML5 1.1 W3C standardization process 1.2 Markup
  • 48. FUTURE OF WEB DESIGN NYC 2011 Explicit sections (HTML5) <h1> HTML5 <p> HTML5 is currently under development... <p> Like its immediate predecessors, HTML... <h4> W3C standardization process section <p> The Web Hypertext Application... <p> The HTML5 specification... <p> According to the W3C timetable... <p> Ian Hickson, editor of the HTML5... <h6> Markup section <p> HTML5 introduces a number of... <p> The HTML5 syntax is no longer... 1 HTML5 1.1 W3C standardization process 1.2 Markup
  • 49. FUTURE OF WEB DESIGN NYC 2011 Sections ๏ section ๏ article ๏ aside ๏ footer ๏ header ๏ nav 49
  • 50. FUTURE OF WEB DESIGN NYC 2011 Outline limitations in HTML4 <h1> Title <h2> Subtitle <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... 1 Title 1.1 Subtitle
  • 51. FUTURE OF WEB DESIGN NYC 2011 Heading groups (HTML5) hgroup <h1> Title <h2> Subtitle <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... 1 Title
  • 52. FUTURE OF WEB DESIGN NYC 2011 Aside: rooted sections <h1> Title <p> Text content continues... <p> Text content continues... <h2> Section heading <p> Text content continues... <blockquote> <h2> Rooted heading <p> Text content continues... <p> Text content continues... <p> Text content continues... <p> Text content continues... 1 Title 1.1 Section heading
  • 53. FUTURE OF WEB DESIGN NYC 2011 Sectioning roots ๏ body ๏ blockquote ๏ details ๏ fieldset ๏ figure ๏ td 53
  • 55. FUTURE OF WEB DESIGN NYC 2011 Rede nition The em element Represents a span of text text with emphatic stress. <p>HTML5 introduces several <em>really</em> useful elements and a ton of new APIs.</p> The strong element Represents a span of text of great importance. <p>Please fill out the form below. <strong>Note: all fields are required.</strong></p>
  • 56. FUTURE OF WEB DESIGN NYC 2011 Rede nition The b element Represents a span of text offset from its surrounding content, but of no extra importance. <p>This presentation is about <b>HTML5</b>.</p> The i element Represents a span of text in an alternate voice or mood. <p>The <code>b</code> and <code>i</code> elements have been legitimized in HTML5. <i>Go figure.</i></p> <p>I like to work with markup languages because <strong>they are simple and easy to read</strong>. They also have that certain <i lang="fr" title="I don&#8217;t know what">je ne sais quoi</i>.</p>
  • 57. FUTURE OF WEB DESIGN NYC 2011 Rede nition The cite element The title of a cited work (e.g. a book, magazine, or journal). <p>In <cite>Web Form Design</cite>, Luke Wroblewski draws on original research, his considerable experience at Yahoo! and eBay, and the perspectives of many of the field’s leading designers to show you everything you need to know about designing effective and engaging Web forms.</p>
  • 58. FUTURE OF WEB DESIGN NYC 2011 Rede nition The small element Represents so-called “ ne print” (e.g. disclaimers, caveats, etc.).
  • 59. FUTURE OF WEB DESIGN NYC 2011 Rede nition The hr element Represents a paragraph-level thematic break.
  • 62. time
  • 63. FUTURE OF WEB DESIGN NYC 2011 Expansion 9+ 4+ 6+ 5+ 11.1+ <time>October 25, 2010 8:11 PM</time>
  • 64. FUTURE OF WEB DESIGN NYC 2011 Expansion 9+ 4+ 6+ 5+ 11.1+ <time datetime="2010-10-25T20:11:00-05:00"> October 25, 2010 8:11 PM</time>
  • 65. FUTURE OF WEB DESIGN NYC 2011 Expansion 9+ 4+ 6+ 5+ 11.1+ <time datetime="2010-10-25T20:11:00-05:00" pubdate="pubdate">October 25, 2010 8:11 PM</time>
  • 68. mark
  • 69. mark
  • 70. FUTURE OF WEB DESIGN NYC 2011 Expansion 9+ 4+ 6+ 5+ 11.1+ <ol id="search-results"> <li> <h3><a href="...">Web Upgrade <mark>HTML5</mark> May Weaken Privacy</a></h3> <p>The new language, <mark>HTML5</mark>, could give marketers access to many more details about users' online activities.</p> </li> </ol>
  • 71. FUTURE OF WEB DESIGN NYC 2011 Expansion 6+ soon <details> <summary>This is the visible description</summary> <p>This content would be hidden by default.</p> </details>
  • 72. FUTURE OF WEB DESIGN NYC 2011 Expansion 9+ 4+ 6+ 5+ 11.1+ <figure id="fig-1"> <img src="photo.jpeg" alt=""/> <figcaption>Photo of Albert Einstein</figcaption> </figure> <figure id="fig-2"> <table> <caption>2011 Forecast Earnings</caption> <!-- a bunch of data --> </table> </figure>
  • 73. Forms 10+ ~4+ ~4+ ~4+ ~9+
  • 74. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="email" …/> <input type="url" …/>
  • 75. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="date" name="dob"/>
  • 76. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="number" name="foo"/> <input type="range" min="1" max="11" step=”1” name="foo"/>
  • 77. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="color" name="foo"/> #ff0000
  • 78. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="text" pattern="d{6}w{3}" placeholder="6 digits followed by 3 letters" .../>
  • 79. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="text" autocomplete autofocus form=”contact-form” required .../>
  • 80. FUTURE OF WEB DESIGN NYC 2011 Forms <input type="text" list="countries" name="country"/> <datalist id="countries"> <option>Afghanistan</option> <option>Åland Islands</option> <!-- ... --> </datalist>
  • 81. Accessibility 8+ 3+ ~4+ ~4+ ~9.5+
  • 83. FUTURE OF WEB DESIGN NYC 2011 What is it?
  • 84. FUTURE OF WEB DESIGN NYC 2011 What is it?
  • 85. FUTURE OF WEB DESIGN NYC 2011 What is it? <button>Tweet</button> <a class=”button”>Tweet</a>
  • 86. FUTURE OF WEB DESIGN NYC 2011 What is it? <button>Tweet</button> <a class=”button”>Tweet</a>
  • 87. FUTURE OF WEB DESIGN NYC 2011 What is it?
  • 88. FUTURE OF WEB DESIGN NYC 2011 What is it?
  • 89. FUTURE OF WEB DESIGN NYC 2011 What is it? <button>Search Mail</button> <div>Search Mail</div>
  • 90. FUTURE OF WEB DESIGN NYC 2011 What is it? <button>Search Mail</button> <div>Search Mail</div>
  • 91. FUTURE OF WEB DESIGN NYC 2011 ARIA maps the OS to the web
  • 93. FUTURE OF WEB DESIGN NYC 2011 All the web’s a play… <section id="main" role="main"> <!-- The primary content for the page would go here --> </section>
  • 104. FUTURE OF WEB DESIGN NYC 2011 Semantic comparison Ad-hoc ARIA Role HTML5 #header, #top banner header (kind of) #main, #content main none #extra, .sidebar complementary, note aside #footer, #bottom contentinfo footer #nav navigation nav .hentry article article
  • 106. FUTURE OF WEB DESIGN NYC 2011 These are the droids you seek <span role="button">OK</span> <div role="alert"> <p>Something went wrong.</p> </div> <div role="alertdialog"> <p>Something went wrong.</p> <img src="x.png" alt="dismiss" role="button" /> </div>
  • 107. FUTURE OF WEB DESIGN NYC 2011 What is it? <a role=”button”>Tweet</a> class=”button”>Tweet</a>
  • 108. FUTURE OF WEB DESIGN NYC 2011 What is it? <a role=”button”>Tweet</a>
  • 109. FUTURE OF WEB DESIGN NYC 2011 102
  • 110. FUTURE OF WEB DESIGN NYC 2011 103
  • 112. FUTURE OF WEB DESIGN NYC 2011 What’s happening? B B (off) (on) <span> <img src="bold-off.png" alt="bold" /> </span> <span> <img src="bold-on.png" alt="bold" /> </span>
  • 113. FUTURE OF WEB DESIGN NYC 2011 What’s happening? B B (off) (on) <span> <img src="bold-off.png" alt="not bold" /> </span> <span> <img src="bold-on.png" alt="bold" /> </span>
  • 114. FUTURE OF WEB DESIGN NYC 2011 What’s happening? B B (off) (on) <span role="button" aria-pressed="false"> <img src="bold-off.png" alt="not bold" /> </span> <span role="button" aria-pressed="true"> <img src="bold-on.png" alt="bold" /> </span>
  • 116. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here!
  • 117. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here! <input class="tweet-counter" value="140" disabled="disabled">
  • 118. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here! <span id="chars_left_notice" class="numeric"> <strong id="status-field-char-counter" class="char-counter">140</strong> </span>
  • 119. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here! <span class="tweet-counter">140 <b class="hidden"> characters remaining</b></span> .hidden { position: absolute; left: −999em; }
  • 120. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here! <span class="tweet-counter">maximum of 140 characters</span> <span class="tweet-counter">140 <b class="hidden"> characters remaining</b></span>
  • 121. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here! <span aria-live="polite" aria-atomic="true" class="tweet-counter">140<b class="hidden"> characters remaining</b></span>
  • 122. FUTURE OF WEB DESIGN NYC 2011 Hey! Over here!
  • 132. FUTURE OF WEB DESIGN NYC 2011 Microdata <img src="nasty.png" data-nsfw="true"/>
  • 133. FUTURE OF WEB DESIGN NYC 2011 Microdata <img src="low-res-photo.png" data-hi-res="high-res-photo.png"/>
  • 134. FUTURE OF WEB DESIGN NYC 2011 Microdata <section id="comments"> <a id="comment-loader" data-replace="/comments-only-for-url-title/" href="/article-with-comments"> View comments on this entry and add your own </a> </section>
  • 135. FUTURE OF WEB DESIGN NYC 2011 Microdata (function( $ ){ $.fn.ajaxInclude = function(){ return this.each(function(){ var $el = $( this ), target = $el.data( 'target' ), $targetEl = target && $( target ) || $el, methods = [ 'append', 'replace', 'before', 'after' ], ml = methods.length, method, url; while ( ml-- ) { method = methods[ ml ]; if ( $el.is( '[data-' + method + ']' ) ) { url = $el.data( method ); break; } } if ( method == 'replace' ){ method += 'With'; } if ( url && method ) { $.get( url, function( data ){ $el.trigger( 'ajaxInclude', [$targetEl, data] ); $targetEl[ method ]( data ); }); } }); }; })( jQuery );
  • 138. FUTURE OF WEB DESIGN NYC 2011 Audio <audio src="my.oga" controls="controls"></audio>
  • 139. FUTURE OF WEB DESIGN NYC 2011 Audio Browser .aac .mp3 .oga .wav Chrome 6+ YES YES YES NO Firefox 3.6+ NO NO YES YES Internet Explorer 9+ YES YES NO YES Opera 10.5+ NO NO YES YES Safari 5+ YES YES NO YES
  • 140. FUTURE OF WEB DESIGN NYC 2011 Audio <audio controls="controls"> <source src="my.mp3"/> <source src="my.oga"/> <!-- fallback --> </audio>
  • 141. FUTURE OF WEB DESIGN NYC 2011 Audio <audio controls="controls" autobuffer="autobuffer" preload="auto"> <source src="my.mp3"/> <source src="my.oga"/> <!-- fallback --> </audio>
  • 142. FUTURE OF WEB DESIGN NYC 2011 Audio <audio controls="controls" autobuffer="autobuffer" preload="auto"> <source src="my.mp3"/> <source src="my.oga"/> <ul> <li><a href="my.mp3">Download MP3</a></li> <li><a href="my.oga">Download Ogg</a></li> </ul> </audio>
  • 143. FUTURE OF WEB DESIGN NYC 2011 Audio <audio controls="controls" autobuffer="autobuffer" preload="auto"> <source src="my.mp3"/> <source src="my.oga"/> <object …> <!-- flash player goes here --> <ul> <li><a href="my.mp3">Download MP3</a></li> <li><a href="my.oga">Download Ogg</a></li> </ul> </object> </audio>
  • 144. FUTURE OF WEB DESIGN NYC 2011 Audio $('audio').each(function(){ var $audio = $(this), media = {}, formats = []; $audio.find('source').each(function(){ var src = $(this).attr('src'), ext = src.split('.').pop(); media[ext] = src; formats.push(ext); }); $audio.jPlayer({ swfPath: '/vendors/jPlayer', ready: function(){ $audio.jPlayer('setMedia', media); }, supplied: formats.join(', ') }); }); Using jQuery & jPlayer
  • 145. FUTURE OF WEB DESIGN NYC 2011 Audio $('audio').each(function(){ var audio = this, $button = $('<button>Play</button>') .click(function(){ audio.play(); }); $(this) .removeAttr('controls') .after($button); }); Using jQuery
  • 147. FUTURE OF WEB DESIGN NYC 2011 Video <video src="my.ogv" controls="controls"></video>
  • 148. FUTURE OF WEB DESIGN NYC 2011 Video Video le = container le (like ZIP) ๏ 1 video track ๏ 1 (or more) audio tracks ๏ metadata ๏ subtitle/caption tracks (optional) 141
  • 149. FUTURE OF WEB DESIGN NYC 2011 Video formats ๏ Flash Video (. v) Prior to 2008, the only video format supported in Adobe Flash. ๏ MPEG 4 (.m4v or .mp4) Based on QuickTime; iTunes uses this format. ๏ Ogg (.ogv) Open source container format. ๏ WebM (.webm) New format announced in May 2010. 142
  • 150. FUTURE OF WEB DESIGN NYC 2011 Video codecs ๏ H.264 Used primarily in MPEG 4. Only video codec natively supported on iOS. Patented. ๏ Theora Used primarily in Ogg. Royalty free. Supported in Firefox 3.5+ (in Ogg). ๏ VP8 Used primarily in WebM. Owned by Google, but licensed royalty-free. 143
  • 151. FUTURE OF WEB DESIGN NYC 2011 Audio codecs ๏ MP3 Nearly universal in usage, but was part of FLV. Patented. ๏ AAC (Advanced Audio Coding) Used primarily in MP4. Patented. ๏ Vorbis Used in Ogg audio & video as well as WebM. Royalty-free. 144
  • 152. FUTURE OF WEB DESIGN NYC 2011 Video Browser .m4v .ogv .webm (AAC + H.264) (Vorbis + Theora) (Vorbis + VP8) Chrome 4-16 4+ 6+ Firefox NO 3.5+ 4+ Internet Explorer 9+ NO MAYBE Opera NO 10.5+ 10.6+ Safari 3.2+ MAYBE MAYBE
  • 153. FUTURE OF WEB DESIGN NYC 2011 No MIME, no service AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm
  • 154. FUTURE OF WEB DESIGN NYC 2011 Video <video controls="controls" width="640" height="480"> <source src="my.m4v"/> <source src="my.webm"/> <source src="my.ogv"/> <!-- fallback --> </video>
  • 155. FUTURE OF WEB DESIGN NYC 2011 Video <video controls="controls" width="640" height="480" poster="my.png"> <source src="my.m4v"/> <source src="my.webm"/> <source src="my.ogv"/> <!-- fallback --> </video>
  • 156. FUTURE OF WEB DESIGN NYC 2011 Video <video controls="controls" width="640" height="480" poster="my.png"> <source src="my.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'/> <source src="my.webm" type='video/webm; codecs="vp8, vorbis"'/> <source src="my.ogv" type='video/ogg; codecs="theora, vorbis"'/> <!-- fallback --> </video> Note: The MPEG 4 codec will depend on the encoding “profiles” you use.
  • 157. FUTURE OF WEB DESIGN NYC 2011 Video <video width="600" height="400" poster="/r/2-5.png" controls="controls" preload="none"> <source src="/r/2-5.m4v" type="video/mp4"/> <source src="/r/2-5.webm" type="video/webm"/> <source src="/r/2-5.ogv" type="video/ogg"/> <img src="/r/2-5.png" width="600" height="400" alt=""/> <ul> <li><a href="/r/2-5.m4v">Download as video/mp4</a></li> <li><a href="/r/2-5.webm">Download as video/webm</a></li> <li><a href="/r/2-5.ogv">Download as video/ogg</a></li> </ul> </video>
  • 158. FUTURE OF WEB DESIGN NYC 2011 Video <video width="600" height="400" poster="/r/2-5.png" controls="controls" preload="none"> <source src="/r/2-5.m4v" type="video/mp4"/> <source src="/r/2-5.webm" type="video/webm"/> <source src="/r/2-5.ogv" type="video/ogg"/> <object width="600" height="400" type="application/x-shockwave-flash" data="flowplayer-3.2.1.swf"> <param name="movie" value="flowplayer-3.2.1.swf"/> <param name="allowfullscreen" value="true"/> <param name="flashvars" value='config={"clip": {"url": "/r/2-5.m4v", "autoPlay":false, "autoBuffering":true}}'/> <img src="/r/2-5.png" width="600" height="400" alt=""/> <ul><!-- links --></ul> </object> </video>
  • 160. FUTURE OF WEB DESIGN NYC 2011 Tools RoadMovie Firefogg
  • 161. FUTURE OF WEB DESIGN NYC 2011 RoadMovie
  • 162. FUTURE OF WEB DESIGN NYC 2011 RoadMovie
  • 163. FUTURE OF WEB DESIGN NYC 2011 RoadMovie
  • 164. FUTURE OF WEB DESIGN NYC 2011 Subtitle formats ๏ SubRip (.srt) ๏ SubViewer (.sub) ๏ SubStation Alpha (.ssa/.ass) ๏ MicroDVD 157
  • 165. FUTURE OF WEB DESIGN NYC 2011 Subtitle formats ๏ SubRip (.srt) 1 00:01:31,041 --> 00:01:32,000 Hello? 2 00:02:10,164 --> 00:02:12,082 Good morning, is your mother in? 158
  • 166. FUTURE OF WEB DESIGN NYC 2011 Subtitle formats ๏ SubViewer (.sub) 00:01:31.04,00:01:32.00 Hello? 00:02:10.16,00:02:12.08 Good morning, is your mother in? 159
  • 167. FUTURE OF WEB DESIGN NYC 2011 RoadMovie
  • 168. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 169. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 170. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 171. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 172. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 173. FUTURE OF WEB DESIGN NYC 2011 FireFogg
  • 174. FUTURE OF WEB DESIGN NYC 2011 Services
  • 177. FUTURE OF WEB DESIGN NYC 2011 localStorage if ( window.localStorage ) { // Sweet! }
  • 178. FUTURE OF WEB DESIGN NYC 2011 localStorage if ( window.localStorage ) { var cache = window.localStorage; cache.setItem( 'test', 'I am storing nuts for the winter.' ); }
  • 179. FUTURE OF WEB DESIGN NYC 2011 localStorage
  • 180. FUTURE OF WEB DESIGN NYC 2011 localStorage if ( window.localStorage ) { var cache = window.localStorage; console.log( cache.getItem('test') ); }
  • 181. FUTURE OF WEB DESIGN NYC 2011 localStorage if ( window.localStorage ) { var cache = window.localStorage; console.log( cache.getItem('test') ); cache.clear(); console.log( cache.getItem('test') ); }
  • 182. FUTURE OF WEB DESIGN NYC 2011 localStorage ๏ is restricted by domain ๏ persists until deleted (programmatically or by the user) ๏ is limited in size (usually 5MB) ๏ is (currently) limited to strings 175
  • 183. FUTURE OF WEB DESIGN NYC 2011 sessionStorage ๏ is like localStorage ๏ disappears when the browser is closed 176
  • 184. FUTURE OF WEB DESIGN NYC 2011 localStorage ๏ is restricted by domain ๏ persists until deleted (programmatically or by the user) ๏ is limited in size (usually 5MB) ๏ is (currently) limited to strings 177
  • 185. FUTURE OF WEB DESIGN NYC 2011 Cue the sad trombone if ( window.localStorage ) { var cache = window.localStorage, obj = { one: 1, two: 2 }; cache.setItem( 'nums', obj ); console.log( cache.getItem( 'nums' ) ); }
  • 186. FUTURE OF WEB DESIGN NYC 2011 Huzzah! if ( window.localStorage ) { var cache = window.localStorage, obj = { one: 1, two: 2 }; cache.setItem( 'nums', JSON.stringify( obj ) ); console.log( JSON.parse( cache.getItem( 'nums' ) ) ); }
  • 187. FUTURE OF WEB DESIGN NYC 2011 localStorage ๏ is restricted by domain ๏ persists until deleted (programmatically or by the user) ๏ is limited in size (usually 5MB) ๏ is (currently) limited to strings ๏ mutable 180
  • 188. FUTURE OF WEB DESIGN NYC 2011 Yikes! window.localStorage.setItem( ‘important’, ‘My locker combo is…’ ); // … window.localStorage.setItem( ‘test’, ‘Just playing around’ ); // … window.localStorage.clear();
  • 190. FUTURE OF WEB DESIGN NYC 2011 Play nicely in the sandbox // create a Squirrel instance with your unique key var $S = new Squirrel( 'scale-song' ); // write a value to the cache $S.write( 'doe', 'ray' ); // read it back $S.read( 'doe' ); // 'ray' // write a value to a sub-cache $S.write( 'song', 'doe', 'a dear, a female dear' ); // read back the original value $S.read( 'doe' ); // 'ray' // read back the sub-cached value $S.read( 'song', 'doe' ); // 'a dear, a female dear' Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
  • 191. FUTURE OF WEB DESIGN NYC 2011 Play nicely in the sandbox // removing a single property from the sub-cache $S.remove( 'song', 'doe' ); // try to read the sub-cached value $S.read( 'song', 'doe' ); // null // read the root value $S.read( 'doe' ); // 'ray' Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
  • 192. FUTURE OF WEB DESIGN NYC 2011 Play nicely in the sandbox // add some more content to the sub-cache $S.write( 'song', 'doe', 'a dear, a female dear' ); $S.write( 'song', 'ray', 'a drop of golden sun' ); // clear the whole sub-cache $S.clear( 'song' ); // check that it's been cleared $S.read( 'song', 'doe' ); // null $S.read( 'song', 'ray' ); // null // check that the root value's still intact $S.read( 'doe' ); // 'ray' Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
  • 193. FUTURE OF WEB DESIGN NYC 2011 Play nicely in the sandbox // remove a property form the main cache $S.remove( 'doe' ); // check it's value $S.read( 'doe' ); // null // write a bit more data in the root and in a sub-cache $S.write( 'doe', 'ray' ); $S.write( 'song', 'doe', 'a dear, a female dear' ); $S.write( 'song', 'ray', 'a drop of golden sun' ); // clear the whole cache $S.clear(); // check it's all gone $S.read( 'song', 'doe' ); // null $S.read( 'song', 'ray' ); // null $S.read( 'doe' ); // null Using Squirrel.js (http://github.com/easy-designs/Squirrel.js)
  • 194. indexedDB ~10+ ~4+ ~11+
  • 195. FUTURE OF WEB DESIGN NYC 2011 indexedDB support if ( “indexedDB” in window ) { // Spec is final & implemented! } else if ( “mozIndexedDB” in window ) { // Mozilla is experimenting } else if ( “msIndexedDB” in window ) { // Microsoft is experimenting } else if ( “webkitIndexedDB” in window ) { // Chrome is experimenting } else { // no dice }
  • 196. FUTURE OF WEB DESIGN NYC 2011 indexedDB Kids Candy Candy Sales
  • 197. FUTURE OF WEB DESIGN NYC 2011 indexedDB var request = window.indexedDB.open( "CandyDB", "My candy store database" );
  • 198. FUTURE OF WEB DESIGN NYC 2011 indexedDB: initialization request.onsuccess = function(event) { var db = event.result; if ( db.version != "1" ) { // Initialize database var createdObjectStoreCount = 0, objectStores = [ { name: "kids", keyPath: "id", autoIncrement: true }, { name: "candy", keyPath: "id", autoIncrement: true }, { name: "candySales", keyPath: "", autoIncrement: true } ], len = objectStores.length, params;   while ( len-- ) { var params = objectStores[len]; request = db.createObjectStore( params.name, params.keyPath, params.autoIncrement ); request.onsuccess = objectStoreCreated; } } else { // User has been here before, no initialization required. loadData(db); } };
  • 199. FUTURE OF WEB DESIGN NYC 2011 indexedDB: initialization function objectStoreCreated(event) { if ( ++createdObjectStoreCount == objectStores.length ) { db.setVersion("1").onsuccess = function(event) { loadData(db); }; } }
  • 200. FUTURE OF WEB DESIGN NYC 2011 indexedDB: create var kids = [ { name: "Anna" }, { name: "Betty" }, { name: "Christine" } ]; var request = window.indexedDB.open( "CandyDB", "My candy store database" ); request.onsuccess = function(e) { var objectStore = e.result.objectStore("kids"), var i=0, len=kids.length; while ( i < len ) { var kid = kids[i++]; objectStore.add(kid).onsuccess = function(e) { console.log( "Saved record for " + kid.name + " with id " + e.result ); }; } };
  • 201. FUTURE OF WEB DESIGN NYC 2011 indexedDB: read request.onsuccess = function(e) { // Enumerate the entire object store. request = e.result.objectStore("kids").openCursor(); request.onsuccess = function( event ) { var cursor = event.result; // If cursor is null … done if (!cursor) { return; } console.log( cursor.value.name ); cursor.continue(); }; };
  • 202. FUTURE OF WEB DESIGN NYC 2011 indexedDB: read w/ join var candyEaters = []; request.onsuccess = function(event) { var db = event.result, transaction = db.transaction(["kids", "candySales"]); transaction.oncomplete = function(){ console.log(candyEaters); }, kidCursor, saleCursor, salesLoaded=false, count;   var kidsStore = transaction.objectStore("kids"); kidsStore.openCursor().onsuccess = function(event) { kidCursor = event.result; count = 0; attemptWalk(); } var salesStore = transaction.objectStore("candySales"); var kidIndex = salesStore.index("kidId"); kidIndex.openObjectCursor().onsuccess = function(event) { saleCursor = event.result; salesLoaded = true; attemptWalk(); } //…
  • 203. FUTURE OF WEB DESIGN NYC 2011 indexedDB: read w/ join // … function attemptWalk() { if (!kidCursor || !salesLoaded) return;   if ( saleCursor && kidCursor.value.id == saleCursor.kidId ) { count++; saleCursor.continue(); } else { candyEaters.push({ name: kidCursor.value.name, count: count }); kidCursor.continue(); } } } // end request.onsuccess
  • 205. FUTURE OF WEB DESIGN NYC 2011 DB Alternatives ๏ LocalStorageDB https://github.com/easy-designs/LocalStorageDB.js ๏ localStorageDB https://github.com/knadh/localStorageDB 198
  • 206. FUTURE OF WEB DESIGN NYC 2011 LocalStorageDB example // init var DB = new LocalStorageDB('my_first_database'); // Table Creation DB.CREATE( 'my_first_table', { id: 0, foo: 'bar', test: 'ing' } ); // Insert DB.INSERT_INTO( 'my_first_table', [{test:'ed'},{foo:'bat'}] ); // Read DB.SELECT( 'my_first_table' ); // [{id:0,foo:'bar',test:'ed'}, {id:1,foo:'bat',test:'ing'}] DB.SELECT( 'my_first_table', {foo:'bar'} ); // [{id:0,foo:'bar',test:'ed'}] // Update DB.UPDATE( 'my_first_table', {test:'nada'}, {foo:'bar'} ); DB.SELECT( 'my_first_table', {foo:'bar'} ); // [{id:0,foo:'bar',test:'nada'}] // Delete DB.DELETE( 'my_first_table', {foo:'bar'} ); DB.SELECT( 'my_first_table', {foo:'bar'} ); // []
  • 207. FUTURE OF WEB DESIGN NYC 2011 LocalStorageDB example this.searchArticles = function( q, callback ) { var cat_ids = [], categories = [], articles = _DB.SELECT( 'articles', function( row ){ var $div = $('<div/>').html( row.html ); if ( row.title.indexOf( q ) > -1 || $div.text().indexOf( q ) > -1 ) { row.type = 'article'; cat_ids.push( row.category_id ); return true; } return false; }).LIMIT(6), i = articles.length; _DB.SELECT( 'categories', function( row ){ var i = $.inArray( row.id, cat_ids ); if ( i > -1 ) { categories[cat_ids[i]] = row.slug; } return false; }); while ( i-- ) { articles[i].category_slug = categories[articles[i].category_id]; } if ( callback instanceof Function ) { callback( articles ); } };
  • 208. FUTURE OF WEB DESIGN NYC 2011 localStorageDB example // Initialise. If the database doesn't exist, it is created var lib = new localStorageDB( "library" ); // Check if the database was just created. Useful for initial database setup if ( lib.isNew() ) { // create the "books" table lib.createTable( "books", ["id", "title", "author", "year", "copies"] ); // insert some data lib.insert( "books", { id: "B001", title: "Phantoms in the brain", author: "Ramachandran", year: 1999, copies: 10 } ); // commit the database to localStorage // all create/drop/insert/update/delete operations should be committed lib.commit(); }
  • 209. Geolocation 9+ 3.5+ 5+ 5+ 10.6+
  • 210. FUTURE OF WEB DESIGN NYC 2011 Geolocation if ( navigator.geolocation ) { navigator.geolocation.getCurrentPosition( function(position){ var lat = position.coords.latitude; var lon = position.coords.longitude; }, function(error){ alert('ouch'); } ); }
  • 211. FUTURE OF WEB DESIGN NYC 2011 Geolocation function getPlaceFromFlickr( lat, lon, callback ) { // the YQL statement var yql = 'select * from flickr.places where lat=' + lat + ' and lon=' + lon; // assembling the YQL webservice API var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(yql) + '&format=json&diagnostics=false&callback=' + callback; // create a new script node and add it to the document var s = document.createElement('script'); s.setAttribute( 'src', url ); document.getElementsByTagName('head')[0].appendChild(s); }; // …
  • 212. FUTURE OF WEB DESIGN NYC 2011 Geolocation // callback in case there is a place found function output(o){ if ( typeof(o.query.results.places.place) != 'undefined' ) { console.log( o.query.results.places.place.name ); } }
  • 213. FUTURE OF WEB DESIGN NYC 2011 Geolocation if ( navigator.geolocation ) { navigator.geolocation.getCurrentPosition( function(position){ getPlaceFromFlickr( position.coords.latitude, position.coords.longitude, 'output' ); }, function(error){ alert('ouch'); } ); }
  • 214. Offline 10+ 3.5+ 4+ 4+ 10.6+
  • 215. FUTURE OF WEB DESIGN NYC 2011 Offline <html manifest="manifest.appcache">
  • 216. FUTURE OF WEB DESIGN NYC 2011 Offline CACHE MANIFEST # Cache manifest version 1.0 # Change the version number to trigger an update CACHE: index.php c/main.css j/main.js i/logo.png # when offline, change content FALLBACK: / /offline.html # never cached NETWORK: signup.html manifest.appcache served with MIME of text/cache-manifest
  • 217. FUTURE OF WEB DESIGN NYC 2011 Offline navigator.onLine // true or false
  • 218. FUTURE OF WEB DESIGN NYC 2011 Limits ๏ Safari (desktop): ∞ ๏ Safari (iOS): 10MB ๏ Chrome: 5MB* ๏ Android: ∞ ๏ Firefox: ∞** ๏ Opera: 50MB*** * Installed “Apps” get more ** Permission required *** User-adjustable 211
  • 219. Lunch!
  • 221. FUTURE OF WEB DESIGN NYC 2011 Parsing errors p{ color: red; }
  • 222. FUTURE OF WEB DESIGN NYC 2011 Parsing errors p{ color: red; }
  • 223. FUTURE OF WEB DESIGN NYC 2011 Parsing errors p{ color: red; font-weight: bold; }
  • 224. FUTURE OF WEB DESIGN NYC 2011 Parsing errors p{ color: red; font-weight: bold; }
  • 225. FUTURE OF WEB DESIGN NYC 2011 Parsing errors p { color: #ccc; color: rgba( 0, 0, 0, .5 ); }
  • 226. FUTURE OF WEB DESIGN NYC 2011 Parsing errors html[lang] p { color: #ccc; color: rgba( 0, 0, 0, .5 ); }
  • 227. FUTURE OF WEB DESIGN NYC 2011 Parsing errors @-moz-document url-prefix() { html[lang] p { color: #ccc; color: rgba( 0, 0, 0, .5 ); } }
  • 228. #intro { /* Basic Layout */ } /* ... */ body[id=css-zen-garden] #intro { /* Advanced Layout */ }
  • 229. #intro { /* Basic Layout */ } /* ... */ [foo], #intro { /* Advanced Layout */ }
  • 230. FUTURE OF WEB DESIGN NYC 2011 Parsing errors @import 'not-for-IE7-or-below.css' screen; @media screen, print, refrigerator { /* IE will get these rules */ }
  • 231. FUTURE OF WEB DESIGN NYC 2011 Organization design
  • 232. FUTURE OF WEB DESIGN NYC 2011 Organization
  • 233. FUTURE OF WEB DESIGN NYC 2011 Organization
  • 234. FUTURE OF WEB DESIGN NYC 2011 Organization type color layout
  • 235. FUTURE OF WEB DESIGN NYC 2011 Organization /* =Typography */ img { display: block; } /* =Layout */ @media screen { .frame .inner { border: 10px solid; } } /* =Color */ .frame .inner { background-color: rgb(227, 222, 215); border-color: rgb(227, 222, 215); }
  • 236. FUTURE OF WEB DESIGN NYC 2011 Organization type.css layout.css color.css
  • 237. FUTURE OF WEB DESIGN NYC 2011 Organization type.css layout.css main.css color.css
  • 238. FUTURE OF WEB DESIGN NYC 2011 Organization {embed="styles/typography"} @media screen {   {embed="styles/layout-screen"} } {embed="styles/color"}
  • 239. FUTURE OF WEB DESIGN NYC 2011 Organization {embed="styles/reset"} {embed="styles/typography"} @media screen {   {embed="styles/layout-screen"} } @media print {   {embed="styles/layout-print"} } {embed="styles/color"} {embed="styles/effects"}
  • 240. FUTURE OF WEB DESIGN NYC 2011 Monkey-patching <link rel="stylesheet" href="main.css"/> <!--[if IE 9]><link rel="stylesheet" href="ie9.css"/><![endif]--> <!--[if lte IE 8]><link rel="stylesheet" href="ie8.css"/><![endif]--> <!--[if lte IE 7]><link rel="stylesheet" href="ie7.css"/><![endif]--> <!--[if lte IE 6]><link rel="stylesheet" href="ie6.css"/><![endif]-->
  • 241. FUTURE OF WEB DESIGN NYC 2011 Monkey-patching @-moz-document url-prefix() { /* GENERATED CONTENT - FF3 doesn't allow positioning */ #extra-mile:before { content: ''; } #extra-mile:first-of-type:before { content: url(extra-mile-sign.png); } }
  • 242. Selectors 9+ 3.5+ 4+ 3.2+ 9.5+
  • 243. FUTURE OF WEB DESIGN NYC 2011 Selectors: attribute /* Basic */ [lang] { outline: 1px solid red; } /* Value */ [title=Search] { outline: 1px solid blue; } /* Space-separated */ [title ~=go] { outline: 1px solid green; } /* starts hyphenated */ [id|=fb] { height:200px; background: red; }
  • 244. FUTURE OF WEB DESIGN NYC 2011 Selectors: attribute /* Starts */ [title^=Click] { outline: 10px solid purple; } /* Ends */ [title$=article] { outline: 1px solid orange; } /* Contains */ [title*=g] { color: red; }
  • 245. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class /* First or last */ p:first-child p:last-child /* First or last of a specific type */ p:first-of-type p:last-of-type /* One is the loneliest number */ p:only-child p:only-of-type /* Nature abhors a vacuum */ p:empty
  • 246. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class /* Specific elements */ p:nth-child(1) p:nth-child(5) /* All paragraphs */ p:nth-child(1n+0) p:nth-child(n+0) p:nth-child(n) /* Same as a simple element selector, but more specific */
  • 247. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class /* Stripey! */ :nth-child(odd) { background: white; } :nth-child(even) { background: grey; } /* Stripey! */ :nth-child(2n+1) { background: white; } :nth-child(2n+0) { background: grey; } /* Alternate paragraph colours in CSS */ p:nth-child(4n+1) { color: navy; } p:nth-child(4n+2) { color: green; } p:nth-child(4n+3) { color: maroon; } p:nth-child(4n+4) { color: purple; } /* 9th, 19th, 29th… */ p:nth-child(10n-1) { color: navy; }
  • 248. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class /* Only paragraph elements considered */ p:nth-of-type(odd) { background: white; } p:nth-of-type(even) { background: grey; } /* Every paragraph but first and last */ p:nth-of-type(n+2):nth-last-of-type(n+2) { background: white; }
  • 249. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class /* Negatory good buddy */ p:not(:empty) { outline: 10px solid red; } p:not(:visited) { color: blue; }
  • 250. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo class :enabled :disabled :checked :required :optional :valid :invalid :in-range :out-of-range :read-only :read-write
  • 251. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo element /* Dynamics */ p::first-letter { font-size: 2.8em; float: left; line-height: 1; margin-right: .1em; } p::first-line { font-weight: bold; }
  • 252. FUTURE OF WEB DESIGN NYC 2011 Selectors: pseudo element /* Generated content */ p::before { content: ‘hello from CSS’; } p::after { content: ‘goodbye from CSS’; } a::after { content: url(http://graphics8.nytimes.com/images/ multimedia/icons/document_icon.gif); }
  • 253. Media Queries 9+ 3.5+ 4+ 4+ 9.5+
  • 254. FUTURE OF WEB DESIGN NYC 2011 @media blocks @media screen { /* Styles for screen media only */ }
  • 255. FUTURE OF WEB DESIGN NYC 2011 @media blocks+ @media screen and (max-width:450px) { /* Styles for screen media when browser is 450px wide or below */ }
  • 256. FUTURE OF WEB DESIGN NYC 2011 Getting granular @media screen and (min-device-width:1024px) and (max-width:989px), screen and (max-device-width:480px), screen and (max-device-width:480px) and (orientation:landscape), screen and (min-device-width:481px) and (orientation:portrait) { /* Layout for narrower desktop (below 990px) or iPhone running iOS 3 (or equivalent) or iPhone running iOS 4 (or equivalent) in “landscape” view or iPad (or equivalent) in “portrait” view */ }
  • 257. FUTURE OF WEB DESIGN NYC 2011 Mobile First w/ media queries /* Universal Layout */ @media screen { /* Styles for all screens */ } @media screen and (min-width:481px) { /* Styles for all screens 480px+ width */ } @media screen and (min-width:754px) { /* Styles for all screens 754px+ width */ }
  • 258. FUTURE OF WEB DESIGN NYC 2011 Patching IE8- @media screen and (min-width:480px) { /* styles for 480px and up go here */ } main.css <link rel=”stylesheet” href=”main.css”/> <script src=”respond.min.js”></script> index.html https://github.com/scottjehl/Respond
  • 259. Colors 9+ 3+ 4+ 3.1+ 10+
  • 260. FUTURE OF WEB DESIGN NYC 2011 Colors: keywords p { color: red; }
  • 261. FUTURE OF WEB DESIGN NYC 2011 Colors: hexadecimal p { color: #f00; }
  • 262. FUTURE OF WEB DESIGN NYC 2011 Colors: RGB p { color: rgb( 255, 0, 0 ); }
  • 263. FUTURE OF WEB DESIGN NYC 2011 Colors: HSL p { color: #f00; color: hsl( 0, 100%, 50% ); }
  • 264. FUTURE OF WEB DESIGN NYC 2011 Colors: HSLa p { color: #F99; color: hsla( 0, 100%, 50%, .5 ); }
  • 265. FUTURE OF WEB DESIGN NYC 2011 Colors: RGBa p { color: #F99; color: rgba( 255, 0, 0, .5 ); }
  • 266. Backgrounds 9+ 4+ 4+ 5+ 10.5+
  • 267. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 3.6+ 4+ 5+ 10+ p { background: url(first.png), url(second.png), url(third.png); background-position: top left; background-repeat: no-repeat; }
  • 268. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 3.6+ 4+ 5+ 10+ p { background: url(first.png) right bottom, url(second.png) center center, #fff url(third.png) bottom right; background-repeat: no-repeat; }
  • 269. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 11+ p { background: red; background-clip: border-box; /* or padding|content-box */ border: 10px dashed; padding: 10px; } FF 1-3.6 requires -moz- and doesn’t accept the “-box” portion
  • 270. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 11+ p { background: url(image-1.png), red url(image-2.png); background-clip: border-box, content-box; border: 10px dashed; padding: 10px; }
  • 271. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 11+ p { background: url(image-1.png); background-origin: border-box; /* or padding|content-box */ border: 10px dashed; padding: 10px; } FF 3.6 requires -moz- and doesn’t accept the “-box” portion
  • 272. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 10.5+ p { background: url(image-1.png), url(image-2.png); background-size: 100px 50px, auto; border: 10px dashed; padding: 10px; } FF 3.6 requires -moz-
  • 273. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 10.5+ p { background: url(image-1.png), url(image-2.png); background-size: cover; border: 10px dashed; padding: 10px; } FF 3.6 requires -moz-
  • 274. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 4+ 4+ 5+ 10.5+ p { background: url(image-1.png), url(image-2.png); background-size: contain; border: 10px dashed; padding: 10px; } FF 3.6 requires -moz-
  • 275. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 10.5+ p { background: url(image-1.png), url(image-2.png); background-repeat: space; border: 10px dashed; padding: 10px; } FF 3.6 requires -moz-
  • 276. FUTURE OF WEB DESIGN NYC 2011 Backgrounds 9+ 10.5+ p { background: url(image-1.png), url(image-2.png); background-repeat: round; border: 10px dashed; padding: 10px; } FF 3.6 requires -moz-
  • 277. Gradients 10+ 3.6+ 4+ 4+ 11+
  • 278. FUTURE OF WEB DESIGN NYC 2011 Gradients p { background: #1e5799; /* Old browsers */ background: -moz-linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100% ); /* FF3.6+ */ background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8) ); /* Chrome,Safari4+ */ background: -webkit-linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100% ); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100% ); /* Opera 11.10+ */ background: -ms-linear-gradient( top, #1e5799 0%,#2989d8 50%,#207cca 51%, #7db9e8 100%); /* IE10+ */ background: linear-gradient( top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100% ); /* W3C */ }
  • 280. Box Shadow 9+ ~3.5+ ~4+ ~3.1+ 10.5+
  • 281. FUTURE OF WEB DESIGN NYC 2011 Box shadow p { box-shadow: -5px /* Horizontal offset */ 5px /* Vertical offset */ 15px /* Blur radius (optional) */ 7px /* Spread distance (optional) */ #fff; /* Color */ }
  • 282. FUTURE OF WEB DESIGN NYC 2011 Box shadow p { box-shadow: inset /* Horizontal offset (optional) */ -5px /* Horizontal offset */ 5px /* Vertical offset */ 15px /* Blur radius (optional) */ 7px /* Spread distance (optional) */ #000; /* Color */ }
  • 285. FUTURE OF WEB DESIGN NYC 2011 Box shadow p { box-shadow: -5px 5px 15px 7px #fff, 5px -5px 15px 7px #f00; }
  • 286. Text Shadow 10+ ~3.5+ ~4+ ~4+ 9.5+
  • 287. FUTURE OF WEB DESIGN NYC 2011 Text shadow p { text-shadow: -5px /* Horizontal offset */ 5px /* Vertical offset */ 15px /* Blur radius (optional) */ #fff; /* Color */ }
  • 288. FUTURE OF WEB DESIGN NYC 2011 Text shadow p { text-shadow: 5px 0px 0px #F5602A, 10px 0px 0px #EDB037, 15px 0px 0px #EBF21F, 20px 0px 0px #71F723, 25px 0px 0px #20EEF5, 30px 0px 0px #3019FF, 35px 0px 0px #DB20E8; }
  • 290. Border Images 10? ~3.5+ ~4+ ~3.21+ ~10.5+
  • 291. FUTURE OF WEB DESIGN NYC 2011 Border images p { border-image: url(border.png) /* Horizontal offset */ 27 / /* Vertical offset */ round /* Blur radius (optional) */ stretch; /* Color */ } Blah blah blah blah. Blah blah blah blah. Blah blah blah blah blah.
  • 293. Box Sizing 8+ ~2+ ~4+ ~3.1+ ~9.5+
  • 294. FUTURE OF WEB DESIGN NYC 2011 Box sizing p.one { box-sizing: content-box; /* Standards Mode */ } p.two { box-sizing: border-box; /* Like Quirks Mode */ } Content Box 5px Border Box 200px
  • 295. Transitions ~10+ ~4+ ~4+ ~3.1+ ~10.5+
  • 296. FUTURE OF WEB DESIGN NYC 2011 Transitions a { transition: color /* Property */ 2s /* Duration */ linear /* Function (optional) */ 0.5s; /* Delay (optional) */ }
  • 297. FUTURE OF WEB DESIGN NYC 2011 Transitions a { transition-property: color, font-size; transition-duration: .5s; transition-timing-function: ease-in-out, linear; }
  • 298. 2D Transformations ~9+ ~3.5+ ~4+ ~3.1+ ~10.5+
  • 299. FUTURE OF WEB DESIGN NYC 2011 Transformations p { transform: rotate(45deg); transform-origin: 50% 50% } t es at is is Th
  • 300. FUTURE OF WEB DESIGN NYC 2011 Transformations p { transform: rotate(15deg) scale(.5) translateX(20px) translateY(-20px); }
  • 301. FUTURE OF WEB DESIGN NYC 2011 Transformation functions ๏ scale, scaleX, scaleY ๏ skew, skewX, skewY ๏ translate, translateX, translateY 288
  • 302. Animations ~10+ ~5+ ~4+ ~4+ 12?
  • 303. FUTURE OF WEB DESIGN NYC 2011 Animations @keyframes thisIsMyAnimation { 0% { top: 0px; } 33% { top: 50px; animation-timing-function: ease-out } 100% { top: 100px; left: 10px; } } p { animation: thisIsMyAnimation /* Animation Function */ 4s /* Duration */ linear /* Timing Function */ 1.5s /* Delay */ infinite /* Iterations */ alternate /* Reverse? */ none; /* Fill mode */ }
  • 304. FUTURE OF WEB DESIGN NYC 2011 Animations p { animation: grow 4s linear, shimmy 2s ease-in-out; }