SlideShare a Scribd company logo
HTML 5: The Future of the
                         Web
                                Tim Wright | csskarma.com | @csskarma




Friday, July 23, 2010                                               1
A Brief Introduction
              •         University of Southern California Web Services

              •         CSSKarma

              •         Smashing Magazine & SitePoint


                             csskarma.com/presentations/penn




Friday, July 23, 2010                                                    2
The Goal.




Friday, July 23, 2010               3
What we’ll cover
                        •   What is it?

                        •   Living in the past

                        •   Debunking some rumors

                        •   New Attributes & Elements

                        •   Audio & Video APIs




Friday, July 23, 2010                                   4
What else we’ll cover
                        •   Forms

                        •   Accessibility

                        •   Geolocation

                        •   HTML 5 Storage & sockets

                        •   Browser & Device Support

                        •   Current Events


Friday, July 23, 2010                                  5
HTML 5 = Markup + JS APIs




Friday, July 23, 2010               6
Quick History
                  1991 - Informal HTML        1998 - CSS 2

                  1994 - HTML 2               2000 - XHTML 1

                  1996 - CSS 1 & JavaScript   2002 - Tableless designs

                  1997 - HTML 4               2005 - Ajax

                                              2009 - HTML 5




Friday, July 23, 2010                                                    7
Is HTML 5 Ready?




                                 via ishtml5readyyet.com




Friday, July 23, 2010                                      8
The real scoop
                  •     Last call for a working draft: Oct. 2009

                  •     Candidate recommendation: 2012

                        •   finished spec

                  •     Proposed recommendation: 2022

                        •   2 browsers with full implementation



                                                                   via adactio.com
Friday, July 23, 2010                                                            9
Browser-based usage




Friday, July 23, 2010                         10
Let’s dig around...




Friday, July 23, 2010                         11
What has changed
                              ...everything is lighter




Friday, July 23, 2010                                    12
<!DOCTYPE html>
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
                      Transitional//EN" "http://www.w3.org/TR/
                        xhtml1/DTD/xhtml1-transitional.dtd">


                          •   Why not html5?

                          •   Technically optional




Friday, July 23, 2010                                              13
<meta charset=”utf-8”>
              HTML 4.01
              <meta http-equiv=”Content-Type” content=”text/
              html; charset=utf-8”>

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




                                                               via adactio.com
Friday, July 23, 2010                                                        14
Script & Style
                  Before:
                  <script type=”text/javascript”></script>
                  <style type=”text/css”></style>



                  After:
                  <script></script>
                  <style></style>




Friday, July 23, 2010                                        15
Link relations
                        • <link rel=”icon”
                        • <link rel=”prefetch”
                        • <link rel=”pingback”
                        • <a rel=”external”
                        • <a rel=”tag”




Friday, July 23, 2010                            16
Notable changes
                        Block-level anchors

                        Presentational elements like <i>, <b>,
                        <cite> & <small> redefined




Friday, July 23, 2010                                            17
What was removed
                        Annoying elements: <font>, <big>
                        (but not small), <center>,
                        <frame>, <acronym>

                        Weird attributes we don’t use: bgcolor,
                        axis, border, summary




                                                                  via adactio.com
Friday, July 23, 2010                                                           18
Markup freedom
            <li class="foo">Hello world</li>
            <img src="barf.jpg" alt="picture of vomit" />

            <li class=foo>Hello world
            <img src=barf.jpg alt=picture of vomit>

            <LI CLASS="foo">Hello world</LI>
            <IMG SRC="barf.jpg" ALT="picture of vomit">

            <li class=foo>Hello world</li>
            <img src=foo alt=bar>




                                                            via adactio.com
Friday, July 23, 2010                                                     19
New...building robust applications
                             Attributes



Friday, July 23, 2010                                        20
Editing content

                        <div contentEditable=”true”></div>




Friday, July 23, 2010                                        21
Spellcheck

                        <div spellcheck=”true”></div>




Friday, July 23, 2010                                   22
Hiding elements
                          <div hidden></div>




Friday, July 23, 2010                          23
Easy drag and drop
                         <div draggable=”true”></div>




                 document.addEventListener('dragstart',
                 function(event) {
                    alert(‘drag started’);
                 }, false);




Friday, July 23, 2010                                     24
Microdata
          <section class="vcard" id="hCard-Ricardo-
          Montalban" itemscope="itemscope"
          itemtype="http://www.data-vocabulary.org/
          Person">

          <p itemprop=”name” class=”fn”>Ricardo
          Montalban</p>

          <p itemprop=”nickname” class=”nickname”>Ricky</
          p>

          </section>




Friday, July 23, 2010                                       25
Embedding data-*
       <section data-latitude=”38.254” data-
       longitude=”85.72”>
           [ content ]
       </section>


       Data for the application to consume




Friday, July 23, 2010                          26
Structural Elements
                                ...some new semantics




Friday, July 23, 2010                                   27
Sectioning content
                        <header
                        <footer
                        <nav
                        <aside
                        <section
                        <article
                        <hgroup




Friday, July 23, 2010                          28
<header> & <footer>
                        <header>
                          <h1>Awesome web site</h1>
                        </header>

                        <footer>
                          <p>some site information</p>
                        </footer>




Friday, July 23, 2010                                    29
<nav>
            <nav>
            <ul>
                        <li><a href=”/”>Home</li>
                        <li><a href=”/about”>About</li>
                        <li><a href=”/contact”>Contact</li>
            </ul>
            </nav>




Friday, July 23, 2010                                         30
<aside>
                        <aside>
                          <p>This is content related to the
                          main content, maybe related links of
                          a pull-quote?</p>
                        </aside>




Friday, July 23, 2010                                            31
<section> vs. <div>
                        <section>
                          <p>Contributes to the overall outline
                          of the page & related content</p>
                        </section>




Friday, July 23, 2010                                             32
<article> & <hgroup>
                        <article>
                          <hgroup>
                              <h1>How to skin a cat</h1>
                              <h2>By Jimmy Rollins</h2>
                          </hgroup>
                          <h3>Buy a knife</h3>
                          <p>The article here</p>
                        </article>




Friday, July 23, 2010                                      33
Text-level semantics
                        <figure
                        <figcaption
                        <mark
                        <time
                        <progress




Friday, July 23, 2010                           34
<figure> & <figcaption>
                <figure>
                <img src=”fungi.png” alt=”shower mold”>
                <figcaption>
                  <p>This is mold in my shower, it’s
                  gross</p>
                </figcaption>
                </figure>




Friday, July 23, 2010                                     35
<time> & <mark>
                <time datetime=”13:15”>1:15pm EDT</time>

                This is a <mark>search term</mark>
                highlighter




Friday, July 23, 2010                                      36
<progress>
                Your file is <progress>50%</progress>
                uploaded




Friday, July 23, 2010                                   37
Audio & Video APIs
                              ...filetype matters, apparently




Friday, July 23, 2010                                           38
Audio
                        <audio src=”hey_jude.ogg”>




Friday, July 23, 2010                                39
Audio
         <audio src=”hey_jude.ogg” controls autoplay
         preload>




Friday, July 23, 2010                                  40
Audio
       <audio controls autoplay loop preload=”off”>
           <src=”hey_jude.mp3”> /* webkit */
           <src=”hey_jude.ogg”> /* gecko */
           Your browser stinks   /* jerks */
       </audio>




                        http://media.io/


Friday, July 23, 2010                                 41
Video
       <video controls autoplay poster=”titlescreen.jpg”>
            <src=”monkey.ogv”>
            <src=”monkey.mp4”>
            Your browser still stinks
       </video>




Friday, July 23, 2010                                       42
Fallbacks
                        <video controls autoplay>
                            <src=”monkey.ogv”>
                            <src=”monkey.mp4”>
                             [ flash fallback ]
                             [ text fallback ]
                        </video>


                        Mobile solution?




Friday, July 23, 2010                               43
A/V Controls (play)
                           <p id=”play”>Play</p>




Friday, July 23, 2010                              44
A/V Controls (play)
                        var video = $('#video');
                        var play = $('#play');

                        play.click(function(){
                            if (video.paused == false) {
                                 video.pause();
                                 $(this).text(‘play’);
                             } else {
                                 video.play();
                                 $(this).text(‘pause’);
                             }
                        });




Friday, July 23, 2010                                      45
A/V Controls
                        Let’s see one:
                        http://www.broken-links.com/tests/video/




Friday, July 23, 2010                                              46
HTML...inputs & validation
                              5 Forms



Friday, July 23, 2010                                47
Labeling attributes
            <input      type=”email”>
            <input      type=”url” placeholder=”http://”>
            <input      type=”number” step=”2” min=”10” max=”50”>
            <input      type=”color”>
            <input      type=”range”>
            <input      type=”date”>
            <input      type=”search” autocomplete=”off”>




Friday, July 23, 2010                                               48
More attr & validation
                <input type=”search”>


                <input type=”text” autofocus required>
                             document.getElementById(“q”).focus();




Friday, July 23, 2010                                                49
Custom inputs
                   <input type=”zip” pattern=”regex pattern”
                             required name=”zip”>




Friday, July 23, 2010                                          50
Let’s see one
                        http://www.csskarma.com/lab/demomachine/




Friday, July 23, 2010                                              51
Degradation & Benefits
                        Degrades to a text box

                        Increased usability & conversion rates

                        Easier styling with attribute selectors

                        Easy validation & less spam



Friday, July 23, 2010                                             52
Accessibility
                             Built-in vs. Bolt-on




Friday, July 23, 2010                               53
Built-in accessibility
                        header, footer, nav, article, aside




Friday, July 23, 2010                                         54
Bolt-on accessibility
   <header role=”banner”>
   <ul role=”menu”>
   <li role=”menuitem”>
   <article role=”main”>
   <aside role=”complementary”>
   <footer role=”contentinfo”>




Friday, July 23, 2010                           55
Bolt-on accessibility
          <section aria-atomic=”true” aria-live=”polite”>

          <input aria-required=”true”>


          *HTML5 valid*


                           http://reader.usc.edu/dev/



Friday, July 23, 2010                                       56
I wanna use...menow!
                                     it too



Friday, July 23, 2010                          57
Class names
                        <div class=”header”></div>

                        <div class=”article”></div>

                        <div class=”aside”></div>

                        <div class=”footer”></div>




Friday, July 23, 2010                                 58
Styles
                        article, aside, details, figure,
                        footer, header, hgroup, nav, section {
                          display: block;
                        }




Friday, July 23, 2010                                            59
CreateElement
             <script>
                  document.createElement(‘header’);
                  document.createElement(‘nav’);
                  document.createElement(‘section’);
                  document.createElement(‘article’);
                  document.createElement(‘footer’);
             </script>




Friday, July 23, 2010                                  60
HTML Shiv       by: Remy Sharp
       <!--[if IE]>
       <script src="http://html5shiv.googlecode.com/
       svn/trunk/html5.js">
       </script>
       <![endif]-->




                        http://html5shiv.googlecode.com/svn/trunk/html5.js

Friday, July 23, 2010                                                        61
Server-side JavaScript
                        •   Jaxer

                        •   Creating element in the DOM




Friday, July 23, 2010                                     62
Moving forward
                  Options for moving forward

                  •     doctype & aria roles

                  •     doctype -> class names -> aria roles

                  •     doctype -> new elements -> aria roles

                  •     Client-side JS

                  •     Server-side JS


Friday, July 23, 2010                                           63
The New kids will love it
                             ...the
                                    Web



Friday, July 23, 2010                               64
Old <head>
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//
     EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
     transitional.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" lang="en"
     xml:lang="en">
     <head>
     <meta http-equiv="Content-Type" content="text/html;
     charset=utf-8" />
     <meta name="description" content="html 5 demo" />
     <meta name="keywords" content="example, web site, html5" />
     <title>Title</title>
     <link rel="icon" href="favicon.ico" type="image/x-icon" />
     <link href="website.css" rel="stylesheet" type="text/css"
     media="all" />
     <script type=”text/javascript” src=”website.js”></script>
     </head>



Friday, July 23, 2010                                              65
New <head>
     <!DOCTYPE html>
     <html lang=”en”>
     <head>
     <meta charset=”utf-8”>
     <meta name=”description” content=”html 5 demo”>
     <meta name=”keywords” content=”example, website, html5”>

     <title>Title</title>
     <link rel=”icon” href=”favicon.ico”>
     <link rel=”preftech” href=”nextpage.html”>
     <link href=”website.css” rel=”stylesheet” media=”all”>
     <script src=”website.js”></script>

     </head>




Friday, July 23, 2010                                           66
Old <body>
     <body>
     <div id=”header”><h1><a href=”/”>Site Title</a></
     h1></div>
     <div id=”nav”>
     <ul>
          <li><a href=”/about”>About</a></li>
     </ul>
     </div>
     <div id=”content”></div>
     <div id=”sidebar”></div>
     <div id=”footer”></div>
     </body>




Friday, July 23, 2010                                    67
New <body>
     <body>
     <header role=”banner”><h1><a href=”/”>Site Title</a></
     h1></header>
     <nav>
         <ul role=”menu”>
             <li role=”menuitem”><a href=”#”>About</a></li>
         </ul>
     </nav>
     <article role=”main”></article>
     <aside role=”complimentary”></aside>
     <footer role=”contentinfo”></footer>
     </body>




Friday, July 23, 2010                                         68
Old <form>
     <form action=”” method=”post”>
     <label for=”name”>Name</label>
     <input type=”text” name=”name” id=”name”/>

     <label for=”email”>E-mail</label>
     <input type=”text” name=”email” id=”email”/>

     <label for=”url”>URL</label>
     <input type=”text” name=”url” id=”url”/>

     <button type=”submit”>Submit</button>
     </form>




Friday, July 23, 2010                               69
New <form>
     <form action=”” method=”post”>
     <label for=”name”>Name</label>
     <input type=”text” name=”name” id=”name” required autofocus>

     <label for=”email”>E-mail</label>
     <input type=”email” name=”email” id=”email” required>

     <label for=”url”>URL</label>
     <input type=”url” name=”url” id=”url” placeholder=”http://”
     required>

     <button type=”submit”>Submit</button>
     </form>




Friday, July 23, 2010                                               70
Old <video> (?)
     <object width="640" height="385"><param name="movie"
     value="video.swf"></param><param
     name="allowFullScreen" value="true"></param><param
     name="allowscriptaccess" value="always"></
     param><embed src="video.swf" type="application/x-
     shockwave-flash" allowscriptaccess="always"
     allowfullscreen="true" width="640" height="385"></
     embed></object>




Friday, July 23, 2010                                       71
New <video>
          <video src=”video.mp4” controls preload>




Friday, July 23, 2010                                72
What does clean mean?
                        •   Reduced page weight

                        •   Speed & Responsiveness

                        •   Higher conversions

                        •   Better usability

                        •   Happy users

                        •   Device development


Friday, July 23, 2010                                73
New JavaScript
                             ...and Ninja-like qualities




Friday, July 23, 2010                                      74
New JavaScript
                Finding elements by class (DOM API)
                document.getElementbyClassname(“skipmenu”);

                Finding elements by CSS syntax (selectors API)
                document.querySelectorAll(“#nav ul > li”);

                document.querySelector(“:hover”);



                <li class=foo>Hello world</li>
                <img src=foo alt=bar>




Friday, July 23, 2010                                            75
classList API
           var element = $(‘div’);

           element.classList.add(‘class-name’);
           element.classList.remove(‘class-name’);
           element.classList.toggle(‘class-name’);




                                                     via davidwalsh.name
Friday, July 23, 2010                                                 76
Geolocationbut still way cool
                        Not actually HTML5,




Friday, July 23, 2010                                   77
Data Sources
                          • GPS
                          • Cellular Network
                          • IP




Friday, July 23, 2010                          78
Information
                        •   Latitude
                        •   Longitude
                        •   Accuracy
                        •   Altitude
                        •   Altitude Accuracy
                        •   Heading
                        •   Timestamp
                        •   Speed




Friday, July 23, 2010                           79
Privacy




Friday, July 23, 2010             80
Getting the data
           function youAreHere(position){
              var youAreHere = {
                   latitude          : position.coords.latitude,
                   longitude         : position.coords.longitude,
                   accuracy          : position.coords.accuracy, // meters
                   speed             : position.coords.speed, // mps
                   altitude          : position.coords.altitude,
                   altitudeAccuracy : position.coords.altitudeAccuracy,
                   heading           : position.coords.heading, // degrees
                   timestamp         : position.timestamp
              };
           }




Friday, July 23, 2010                                                        81
Error Handling
           function geoErrors(error){
              if(error.code === 1){
                 $('ul').html('<li>Data not shared by user</li>');
              } else if(error.code === 2){
                 $('ul').html('<li>Data not available for some reason</li>');
              } else if(error.code === 3){
                 $('ul').html('<li>Connection timed out</li>');
              } else if(error.code === 0){
                 $('ul').html('<li>Something else happened</li>');
              }
           }




Friday, July 23, 2010                                                           82
Usage
           if(navigator.geolocation){
                    navigator.geolocation.getCurrentPosition(youAreHere,
              geoErrors,
                 {
                 enableHighAccuracy: true, // increases load time
                 maximumAge:60000, // 10 mins
                 timeout:0 // check the cache first
                 });
           }




Friday, July 23, 2010                                                      83
Let’s see one
                        http://www.csskarma.com/lab/html5/geo/




Friday, July 23, 2010                                            84
Great examples




Friday, July 23, 2010                    85
Storage & Sockets
                                ..set it and forget it




Friday, July 23, 2010                                    86
Local Storage
                         • Persistent to the browser
                         • Super cookies




Friday, July 23, 2010                                  87
Local Storage (setting)
                        var edit = document.getElementById('edit');
                        !
                        $(edit).blur(function() {
                        ! localStorage.setItem('todoData',
                        this.innerHTML);
                        });




Friday, July 23, 2010                                                 88
Local Storage (getting)
                    if ( localStorage.getItem('todoData') ) {
                      edit.innerHTML = localStorage.getItem
                      ('todoData');
                    }




Friday, July 23, 2010                                           89
Local Storage (forgetting)
       <p><a href=”#clear” id=”clear”>Clear storage</a></p>


       $('#clear').click(function(){
       ! ! localStorage.clear();
       ! ! location.reload(true);
       ! ! return false;
       ! });




Friday, July 23, 2010                                         90
Local Storage (demo)
                        http://www.csskarma.com/lab/html5/localstorage/

                             Using:
                             contentEditable=”true”
                             localStorage.setItem()
                             localStorage.getItem()
                             localStorage.clear()




Friday, July 23, 2010                                                     91
Web Sockets
       Bi-directional, full-duplex communications channels,
       over a single TCP socket, designed to be implemented
       in Web browsers and Web servers.

       http://dev.w3.org/html5/websockets/




Friday, July 23, 2010                                         92
Support



Friday, July 23, 2010             93
Active browsers




Friday, July 23, 2010                     94
Browser support
                             CanIUse.com




                              HTML5test.com



Friday, July 23, 2010                         95
Modern mobile devices




Friday, July 23, 2010                           96
Effects on mobile




Friday, July 23, 2010                       97
Current Events



Friday, July 23, 2010                    98
WebM video format
           High-quality open video format

           YouTube for compression over ogg (.ogv)

           IE9, Chrome, Firefox & Opera support

           WebM converter -> mirovideoconverter.com



Friday, July 23, 2010                                 99
New <track> Element



Friday, July 23, 2010                         100
Resources



Friday, July 23, 2010               101
Resources
                        •   webmproject.org

                        •   HTML5Doctor.com

                        •   HTML5gallery.com

                        •   data-vocabulary.org

                        •   WHATWG.org

                        •   HTML5 for Designers


Friday, July 23, 2010                             102
What we covered
                        •   What is it?

                        •   Living in the past

                        •   Debunking some rumors

                        •   New Attributes & Elements

                        •   Audio & Video APIs




Friday, July 23, 2010                                   103
What we covered (cont.)
                        •   Forms

                        •   Accessibility

                        •   Geolocation

                        •   HTML 5 Storage & sockets

                        •   Browser & Device Support

                        •   Current Events


Friday, July 23, 2010                                  104
Steal my work




                        csskarma.com/presentations/penn/


Friday, July 23, 2010                                      105
“Never memorize
                something you that can
                      look up”
                 - Albert Einstein



Friday, July 23, 2010                    106
Questions?



Friday, July 23, 2010                107
Find me online
                        e-mail: timwright@csskarma.com
                        web: http://www.csskarma.com
                        twitter: @csskarma




                                               </presentation>



Friday, July 23, 2010                                            108

More Related Content

PDF
Opening up the Social Web - Standards that are bridging the Islands
PDF
Distributed Social Networking
PDF
The Tech Side of Project Argo
PDF
Dojo Basics Js UserGroup Chicago
KEY
Websockets - DevFestX May 19, 2012
PDF
Please Don't Touch the Slow Parts
PDF
CSS3: The Future is Now at Drupal Design Camp Boston
PDF
MongoDB on Rails (and Ruby)
Opening up the Social Web - Standards that are bridging the Islands
Distributed Social Networking
The Tech Side of Project Argo
Dojo Basics Js UserGroup Chicago
Websockets - DevFestX May 19, 2012
Please Don't Touch the Slow Parts
CSS3: The Future is Now at Drupal Design Camp Boston
MongoDB on Rails (and Ruby)

What's hot (12)

PDF
Introduction to jQuery :: CharlotteJS
PDF
Custom YUI Widgets
PDF
WSGI, Django, Gunicorn
PDF
Presentation to wdim_students
PDF
Large problems, Mostly Solved
PDF
BitcoinJS Webtuesday Presentation
PDF
Scaling webappswithrabbitmq
PDF
Symfony2 and MongoDB - MidwestPHP 2013
PDF
Social networks of Wikipedia - Paolo Massa - Presentation at (2011). ACM Hype...
PDF
Things to use, find and share
PDF
Idiots guide to jquery
PDF
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Introduction to jQuery :: CharlotteJS
Custom YUI Widgets
WSGI, Django, Gunicorn
Presentation to wdim_students
Large problems, Mostly Solved
BitcoinJS Webtuesday Presentation
Scaling webappswithrabbitmq
Symfony2 and MongoDB - MidwestPHP 2013
Social networks of Wikipedia - Paolo Massa - Presentation at (2011). ACM Hype...
Things to use, find and share
Idiots guide to jquery
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Ad

Viewers also liked (20)

PDF
Academic Position in Quantum Chemistry of Electronically Excited States
PDF
Grow Your Business with Email Marketing Chelmsford
PDF
Organización y funcionamiento - CEIP (2010)
PDF
Annual Report 13.14
DOCX
Cátedra de cultura ciudadana
PDF
Harmonic drive hpn brochure
PPT
Presentacion del ceat 2005
PPT
Addressing gaps in clinically useful evidence on potential drug-drug interact...
PDF
Agua para unesco
PDF
FICHA TÉCNICA ELECTROESTIMULADOR COMPEX SP 4.0
PDF
Resumen Ejecutivo . Teens 2010 castellano
PDF
The Puerto Rican Diaspora: Education and Cultural Exchanges
PDF
Medical Waste Treatment
PDF
Thesis - Campus Knowledge of eSports
PPT
Intel.ligència emocional.
PPTX
Dirección de Personal Cap 06
PPT
A present history of critical GIS
PPTX
Microcontroller architecture programming and interfacing
PDF
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
PPTX
Identidad de marca de moda Inexmoda
Academic Position in Quantum Chemistry of Electronically Excited States
Grow Your Business with Email Marketing Chelmsford
Organización y funcionamiento - CEIP (2010)
Annual Report 13.14
Cátedra de cultura ciudadana
Harmonic drive hpn brochure
Presentacion del ceat 2005
Addressing gaps in clinically useful evidence on potential drug-drug interact...
Agua para unesco
FICHA TÉCNICA ELECTROESTIMULADOR COMPEX SP 4.0
Resumen Ejecutivo . Teens 2010 castellano
The Puerto Rican Diaspora: Education and Cultural Exchanges
Medical Waste Treatment
Thesis - Campus Knowledge of eSports
Intel.ligència emocional.
Dirección de Personal Cap 06
A present history of critical GIS
Microcontroller architecture programming and interfacing
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
Identidad de marca de moda Inexmoda
Ad

Similar to HTML 5: The Future of the Web (20)

PDF
University of Abertay Dundee - evening
PDF
University of Abertay Dundee - afternoon
PDF
Refreshdc html5css3-090719085307-phpapp01
PDF
Up to Speed on HTML 5 and CSS 3
PDF
HTML5/CSS3 @ Baidu
PDF
Html5 coredevsummit
PDF
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
PDF
HTML5 - Moving from hacks to solutions
KEY
Html5 Primer
PDF
In depth with html5 java2days 2010
KEY
The Devil and HTML5
PDF
PDF
HTML XHTML HTML5
PDF
Tim stone.html5.rjug.20110316
PDF
HTML5: About Damn Time
PDF
Introduction to HTML5
PDF
HTML5, just another presentation :)
PDF
[O'Reilly] HTML5 Design
PDF
[edUi] HTML5 Workshop
PDF
Mansoura University CSED & Nozom web development sprint
University of Abertay Dundee - evening
University of Abertay Dundee - afternoon
Refreshdc html5css3-090719085307-phpapp01
Up to Speed on HTML 5 and CSS 3
HTML5/CSS3 @ Baidu
Html5 coredevsummit
Beginner & Intermediate Guide to HTML5/CSS3 In Drupal
HTML5 - Moving from hacks to solutions
Html5 Primer
In depth with html5 java2days 2010
The Devil and HTML5
HTML XHTML HTML5
Tim stone.html5.rjug.20110316
HTML5: About Damn Time
Introduction to HTML5
HTML5, just another presentation :)
[O'Reilly] HTML5 Design
[edUi] HTML5 Workshop
Mansoura University CSED & Nozom web development sprint

More from Tim Wright (18)

PDF
An Introduction to HTTP/2
PDF
Assistive Technology, Experience Design, and Life
PDF
Building an Atomic Design System
PDF
Creating Contextual Applications with Maslow & The Device API
PPTX
USC dot EDU: A Responsive Design Case Study
PDF
Keys to Responsive Design
PDF
Bringing Environmental Design to the Web
PDF
Environmental Design Vol. 2
PDF
Environmental Design on The Web
PDF
Form design
PDF
Color & Typography
PDF
Design process
PDF
A Look at the Future of HTML5
PDF
Implementing a Scalable Mobile Strategy
KEY
Slow kinda sucks
PDF
Mobile, Media & Touch
KEY
Native Device vs. Mobile Web Applications
PDF
Standardizing the Web: A Look into the Why of Web Standards
An Introduction to HTTP/2
Assistive Technology, Experience Design, and Life
Building an Atomic Design System
Creating Contextual Applications with Maslow & The Device API
USC dot EDU: A Responsive Design Case Study
Keys to Responsive Design
Bringing Environmental Design to the Web
Environmental Design Vol. 2
Environmental Design on The Web
Form design
Color & Typography
Design process
A Look at the Future of HTML5
Implementing a Scalable Mobile Strategy
Slow kinda sucks
Mobile, Media & Touch
Native Device vs. Mobile Web Applications
Standardizing the Web: A Look into the Why of Web Standards

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
Teaching material agriculture food technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

HTML 5: The Future of the Web

  • 1. HTML 5: The Future of the Web Tim Wright | csskarma.com | @csskarma Friday, July 23, 2010 1
  • 2. A Brief Introduction • University of Southern California Web Services • CSSKarma • Smashing Magazine & SitePoint csskarma.com/presentations/penn Friday, July 23, 2010 2
  • 4. What we’ll cover • What is it? • Living in the past • Debunking some rumors • New Attributes & Elements • Audio & Video APIs Friday, July 23, 2010 4
  • 5. What else we’ll cover • Forms • Accessibility • Geolocation • HTML 5 Storage & sockets • Browser & Device Support • Current Events Friday, July 23, 2010 5
  • 6. HTML 5 = Markup + JS APIs Friday, July 23, 2010 6
  • 7. Quick History 1991 - Informal HTML 1998 - CSS 2 1994 - HTML 2 2000 - XHTML 1 1996 - CSS 1 & JavaScript 2002 - Tableless designs 1997 - HTML 4 2005 - Ajax 2009 - HTML 5 Friday, July 23, 2010 7
  • 8. Is HTML 5 Ready? via ishtml5readyyet.com Friday, July 23, 2010 8
  • 9. The real scoop • Last call for a working draft: Oct. 2009 • Candidate recommendation: 2012 • finished spec • Proposed recommendation: 2022 • 2 browsers with full implementation via adactio.com Friday, July 23, 2010 9
  • 11. Let’s dig around... Friday, July 23, 2010 11
  • 12. What has changed ...everything is lighter Friday, July 23, 2010 12
  • 13. <!DOCTYPE html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/ xhtml1/DTD/xhtml1-transitional.dtd"> • Why not html5? • Technically optional Friday, July 23, 2010 13
  • 14. <meta charset=”utf-8”> HTML 4.01 <meta http-equiv=”Content-Type” content=”text/ html; charset=utf-8”> XHTML 1.0 <meta http-equiv="Content-Type" content="text/ html; charset=utf-8" /> via adactio.com Friday, July 23, 2010 14
  • 15. Script & Style Before: <script type=”text/javascript”></script> <style type=”text/css”></style> After: <script></script> <style></style> Friday, July 23, 2010 15
  • 16. Link relations • <link rel=”icon” • <link rel=”prefetch” • <link rel=”pingback” • <a rel=”external” • <a rel=”tag” Friday, July 23, 2010 16
  • 17. Notable changes Block-level anchors Presentational elements like <i>, <b>, <cite> & <small> redefined Friday, July 23, 2010 17
  • 18. What was removed Annoying elements: <font>, <big> (but not small), <center>, <frame>, <acronym> Weird attributes we don’t use: bgcolor, axis, border, summary via adactio.com Friday, July 23, 2010 18
  • 19. Markup freedom <li class="foo">Hello world</li> <img src="barf.jpg" alt="picture of vomit" /> <li class=foo>Hello world <img src=barf.jpg alt=picture of vomit> <LI CLASS="foo">Hello world</LI> <IMG SRC="barf.jpg" ALT="picture of vomit"> <li class=foo>Hello world</li> <img src=foo alt=bar> via adactio.com Friday, July 23, 2010 19
  • 20. New...building robust applications Attributes Friday, July 23, 2010 20
  • 21. Editing content <div contentEditable=”true”></div> Friday, July 23, 2010 21
  • 22. Spellcheck <div spellcheck=”true”></div> Friday, July 23, 2010 22
  • 23. Hiding elements <div hidden></div> Friday, July 23, 2010 23
  • 24. Easy drag and drop <div draggable=”true”></div> document.addEventListener('dragstart', function(event) { alert(‘drag started’); }, false); Friday, July 23, 2010 24
  • 25. Microdata <section class="vcard" id="hCard-Ricardo- Montalban" itemscope="itemscope" itemtype="http://www.data-vocabulary.org/ Person"> <p itemprop=”name” class=”fn”>Ricardo Montalban</p> <p itemprop=”nickname” class=”nickname”>Ricky</ p> </section> Friday, July 23, 2010 25
  • 26. Embedding data-* <section data-latitude=”38.254” data- longitude=”85.72”> [ content ] </section> Data for the application to consume Friday, July 23, 2010 26
  • 27. Structural Elements ...some new semantics Friday, July 23, 2010 27
  • 28. Sectioning content <header <footer <nav <aside <section <article <hgroup Friday, July 23, 2010 28
  • 29. <header> & <footer> <header> <h1>Awesome web site</h1> </header> <footer> <p>some site information</p> </footer> Friday, July 23, 2010 29
  • 30. <nav> <nav> <ul> <li><a href=”/”>Home</li> <li><a href=”/about”>About</li> <li><a href=”/contact”>Contact</li> </ul> </nav> Friday, July 23, 2010 30
  • 31. <aside> <aside> <p>This is content related to the main content, maybe related links of a pull-quote?</p> </aside> Friday, July 23, 2010 31
  • 32. <section> vs. <div> <section> <p>Contributes to the overall outline of the page & related content</p> </section> Friday, July 23, 2010 32
  • 33. <article> & <hgroup> <article> <hgroup> <h1>How to skin a cat</h1> <h2>By Jimmy Rollins</h2> </hgroup> <h3>Buy a knife</h3> <p>The article here</p> </article> Friday, July 23, 2010 33
  • 34. Text-level semantics <figure <figcaption <mark <time <progress Friday, July 23, 2010 34
  • 35. <figure> & <figcaption> <figure> <img src=”fungi.png” alt=”shower mold”> <figcaption> <p>This is mold in my shower, it’s gross</p> </figcaption> </figure> Friday, July 23, 2010 35
  • 36. <time> & <mark> <time datetime=”13:15”>1:15pm EDT</time> This is a <mark>search term</mark> highlighter Friday, July 23, 2010 36
  • 37. <progress> Your file is <progress>50%</progress> uploaded Friday, July 23, 2010 37
  • 38. Audio & Video APIs ...filetype matters, apparently Friday, July 23, 2010 38
  • 39. Audio <audio src=”hey_jude.ogg”> Friday, July 23, 2010 39
  • 40. Audio <audio src=”hey_jude.ogg” controls autoplay preload> Friday, July 23, 2010 40
  • 41. Audio <audio controls autoplay loop preload=”off”> <src=”hey_jude.mp3”> /* webkit */ <src=”hey_jude.ogg”> /* gecko */ Your browser stinks /* jerks */ </audio> http://media.io/ Friday, July 23, 2010 41
  • 42. Video <video controls autoplay poster=”titlescreen.jpg”> <src=”monkey.ogv”> <src=”monkey.mp4”> Your browser still stinks </video> Friday, July 23, 2010 42
  • 43. Fallbacks <video controls autoplay> <src=”monkey.ogv”> <src=”monkey.mp4”> [ flash fallback ] [ text fallback ] </video> Mobile solution? Friday, July 23, 2010 43
  • 44. A/V Controls (play) <p id=”play”>Play</p> Friday, July 23, 2010 44
  • 45. A/V Controls (play) var video = $('#video'); var play = $('#play'); play.click(function(){ if (video.paused == false) { video.pause(); $(this).text(‘play’); } else { video.play(); $(this).text(‘pause’); } }); Friday, July 23, 2010 45
  • 46. A/V Controls Let’s see one: http://www.broken-links.com/tests/video/ Friday, July 23, 2010 46
  • 47. HTML...inputs & validation 5 Forms Friday, July 23, 2010 47
  • 48. Labeling attributes <input type=”email”> <input type=”url” placeholder=”http://”> <input type=”number” step=”2” min=”10” max=”50”> <input type=”color”> <input type=”range”> <input type=”date”> <input type=”search” autocomplete=”off”> Friday, July 23, 2010 48
  • 49. More attr & validation <input type=”search”> <input type=”text” autofocus required> document.getElementById(“q”).focus(); Friday, July 23, 2010 49
  • 50. Custom inputs <input type=”zip” pattern=”regex pattern” required name=”zip”> Friday, July 23, 2010 50
  • 51. Let’s see one http://www.csskarma.com/lab/demomachine/ Friday, July 23, 2010 51
  • 52. Degradation & Benefits Degrades to a text box Increased usability & conversion rates Easier styling with attribute selectors Easy validation & less spam Friday, July 23, 2010 52
  • 53. Accessibility Built-in vs. Bolt-on Friday, July 23, 2010 53
  • 54. Built-in accessibility header, footer, nav, article, aside Friday, July 23, 2010 54
  • 55. Bolt-on accessibility <header role=”banner”> <ul role=”menu”> <li role=”menuitem”> <article role=”main”> <aside role=”complementary”> <footer role=”contentinfo”> Friday, July 23, 2010 55
  • 56. Bolt-on accessibility <section aria-atomic=”true” aria-live=”polite”> <input aria-required=”true”> *HTML5 valid* http://reader.usc.edu/dev/ Friday, July 23, 2010 56
  • 57. I wanna use...menow! it too Friday, July 23, 2010 57
  • 58. Class names <div class=”header”></div> <div class=”article”></div> <div class=”aside”></div> <div class=”footer”></div> Friday, July 23, 2010 58
  • 59. Styles article, aside, details, figure, footer, header, hgroup, nav, section { display: block; } Friday, July 23, 2010 59
  • 60. CreateElement <script> document.createElement(‘header’); document.createElement(‘nav’); document.createElement(‘section’); document.createElement(‘article’); document.createElement(‘footer’); </script> Friday, July 23, 2010 60
  • 61. HTML Shiv by: Remy Sharp <!--[if IE]> <script src="http://html5shiv.googlecode.com/ svn/trunk/html5.js"> </script> <![endif]--> http://html5shiv.googlecode.com/svn/trunk/html5.js Friday, July 23, 2010 61
  • 62. Server-side JavaScript • Jaxer • Creating element in the DOM Friday, July 23, 2010 62
  • 63. Moving forward Options for moving forward • doctype & aria roles • doctype -> class names -> aria roles • doctype -> new elements -> aria roles • Client-side JS • Server-side JS Friday, July 23, 2010 63
  • 64. The New kids will love it ...the Web Friday, July 23, 2010 64
  • 65. Old <head> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="html 5 demo" /> <meta name="keywords" content="example, web site, html5" /> <title>Title</title> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link href="website.css" rel="stylesheet" type="text/css" media="all" /> <script type=”text/javascript” src=”website.js”></script> </head> Friday, July 23, 2010 65
  • 66. New <head> <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”utf-8”> <meta name=”description” content=”html 5 demo”> <meta name=”keywords” content=”example, website, html5”> <title>Title</title> <link rel=”icon” href=”favicon.ico”> <link rel=”preftech” href=”nextpage.html”> <link href=”website.css” rel=”stylesheet” media=”all”> <script src=”website.js”></script> </head> Friday, July 23, 2010 66
  • 67. Old <body> <body> <div id=”header”><h1><a href=”/”>Site Title</a></ h1></div> <div id=”nav”> <ul> <li><a href=”/about”>About</a></li> </ul> </div> <div id=”content”></div> <div id=”sidebar”></div> <div id=”footer”></div> </body> Friday, July 23, 2010 67
  • 68. New <body> <body> <header role=”banner”><h1><a href=”/”>Site Title</a></ h1></header> <nav> <ul role=”menu”> <li role=”menuitem”><a href=”#”>About</a></li> </ul> </nav> <article role=”main”></article> <aside role=”complimentary”></aside> <footer role=”contentinfo”></footer> </body> Friday, July 23, 2010 68
  • 69. Old <form> <form action=”” method=”post”> <label for=”name”>Name</label> <input type=”text” name=”name” id=”name”/> <label for=”email”>E-mail</label> <input type=”text” name=”email” id=”email”/> <label for=”url”>URL</label> <input type=”text” name=”url” id=”url”/> <button type=”submit”>Submit</button> </form> Friday, July 23, 2010 69
  • 70. New <form> <form action=”” method=”post”> <label for=”name”>Name</label> <input type=”text” name=”name” id=”name” required autofocus> <label for=”email”>E-mail</label> <input type=”email” name=”email” id=”email” required> <label for=”url”>URL</label> <input type=”url” name=”url” id=”url” placeholder=”http://” required> <button type=”submit”>Submit</button> </form> Friday, July 23, 2010 70
  • 71. Old <video> (?) <object width="640" height="385"><param name="movie" value="video.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></ param><embed src="video.swf" type="application/x- shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></ embed></object> Friday, July 23, 2010 71
  • 72. New <video> <video src=”video.mp4” controls preload> Friday, July 23, 2010 72
  • 73. What does clean mean? • Reduced page weight • Speed & Responsiveness • Higher conversions • Better usability • Happy users • Device development Friday, July 23, 2010 73
  • 74. New JavaScript ...and Ninja-like qualities Friday, July 23, 2010 74
  • 75. New JavaScript Finding elements by class (DOM API) document.getElementbyClassname(“skipmenu”); Finding elements by CSS syntax (selectors API) document.querySelectorAll(“#nav ul > li”); document.querySelector(“:hover”); <li class=foo>Hello world</li> <img src=foo alt=bar> Friday, July 23, 2010 75
  • 76. classList API var element = $(‘div’); element.classList.add(‘class-name’); element.classList.remove(‘class-name’); element.classList.toggle(‘class-name’); via davidwalsh.name Friday, July 23, 2010 76
  • 77. Geolocationbut still way cool Not actually HTML5, Friday, July 23, 2010 77
  • 78. Data Sources • GPS • Cellular Network • IP Friday, July 23, 2010 78
  • 79. Information • Latitude • Longitude • Accuracy • Altitude • Altitude Accuracy • Heading • Timestamp • Speed Friday, July 23, 2010 79
  • 81. Getting the data function youAreHere(position){ var youAreHere = { latitude : position.coords.latitude, longitude : position.coords.longitude, accuracy : position.coords.accuracy, // meters speed : position.coords.speed, // mps altitude : position.coords.altitude, altitudeAccuracy : position.coords.altitudeAccuracy, heading : position.coords.heading, // degrees timestamp : position.timestamp }; } Friday, July 23, 2010 81
  • 82. Error Handling function geoErrors(error){ if(error.code === 1){ $('ul').html('<li>Data not shared by user</li>'); } else if(error.code === 2){ $('ul').html('<li>Data not available for some reason</li>'); } else if(error.code === 3){ $('ul').html('<li>Connection timed out</li>'); } else if(error.code === 0){ $('ul').html('<li>Something else happened</li>'); } } Friday, July 23, 2010 82
  • 83. Usage if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(youAreHere, geoErrors, { enableHighAccuracy: true, // increases load time maximumAge:60000, // 10 mins timeout:0 // check the cache first }); } Friday, July 23, 2010 83
  • 84. Let’s see one http://www.csskarma.com/lab/html5/geo/ Friday, July 23, 2010 84
  • 86. Storage & Sockets ..set it and forget it Friday, July 23, 2010 86
  • 87. Local Storage • Persistent to the browser • Super cookies Friday, July 23, 2010 87
  • 88. Local Storage (setting) var edit = document.getElementById('edit'); ! $(edit).blur(function() { ! localStorage.setItem('todoData', this.innerHTML); }); Friday, July 23, 2010 88
  • 89. Local Storage (getting) if ( localStorage.getItem('todoData') ) { edit.innerHTML = localStorage.getItem ('todoData'); } Friday, July 23, 2010 89
  • 90. Local Storage (forgetting) <p><a href=”#clear” id=”clear”>Clear storage</a></p> $('#clear').click(function(){ ! ! localStorage.clear(); ! ! location.reload(true); ! ! return false; ! }); Friday, July 23, 2010 90
  • 91. Local Storage (demo) http://www.csskarma.com/lab/html5/localstorage/ Using: contentEditable=”true” localStorage.setItem() localStorage.getItem() localStorage.clear() Friday, July 23, 2010 91
  • 92. Web Sockets Bi-directional, full-duplex communications channels, over a single TCP socket, designed to be implemented in Web browsers and Web servers. http://dev.w3.org/html5/websockets/ Friday, July 23, 2010 92
  • 95. Browser support CanIUse.com HTML5test.com Friday, July 23, 2010 95
  • 96. Modern mobile devices Friday, July 23, 2010 96
  • 97. Effects on mobile Friday, July 23, 2010 97
  • 99. WebM video format High-quality open video format YouTube for compression over ogg (.ogv) IE9, Chrome, Firefox & Opera support WebM converter -> mirovideoconverter.com Friday, July 23, 2010 99
  • 100. New <track> Element Friday, July 23, 2010 100
  • 102. Resources • webmproject.org • HTML5Doctor.com • HTML5gallery.com • data-vocabulary.org • WHATWG.org • HTML5 for Designers Friday, July 23, 2010 102
  • 103. What we covered • What is it? • Living in the past • Debunking some rumors • New Attributes & Elements • Audio & Video APIs Friday, July 23, 2010 103
  • 104. What we covered (cont.) • Forms • Accessibility • Geolocation • HTML 5 Storage & sockets • Browser & Device Support • Current Events Friday, July 23, 2010 104
  • 105. Steal my work csskarma.com/presentations/penn/ Friday, July 23, 2010 105
  • 106. “Never memorize something you that can look up” - Albert Einstein Friday, July 23, 2010 106
  • 108. Find me online e-mail: timwright@csskarma.com web: http://www.csskarma.com twitter: @csskarma </presentation> Friday, July 23, 2010 108