SlideShare a Scribd company logo
The Zen of HTML5
Bruce Lawson, Opera Software


 Disruptive Code / Stockholm / 21 September 2010
การรแจงของ HTML5
XHTML 2
<img />
© Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and
                       Opera Software ASA.

You are granted a license to use, reproduce and create derivative works of
                              this document.
HTML5
<!DOCTYPE html>
Geo




SVG
SVG
CSS
New Exciting Web Technology
HTML5 does not replace HTML 4.01
HTML5 has more bling!
HTML5 is umbrella term:
markup elements and JavaScript APIs
28 new elements (or maybe 29)
Top 20 class names
   1. footer                                       11. button
   2. menu                                          12. main
   3. style1                                       13. style3
4. msonormal                                        14. small
    5. text                                          15. nav
  6. content                                        16. clear
    7. title                                       17. search
   8. style2                                       18. style4
  9. header                                         19. logo
10. copyright                                       20. body
     http://devfiles.myopera.com/articles/572/classlist-url.htm
Top 20 id names
    1. footer                                        11. search
   2. content                                         12. nav
    3. header                                      13. wrapper
      4. logo                                         14. top
  5. container                                      15. table2
     6. main                                        16. layer2
    7. table1                                      17. sidebar
     8. menu                                       18. image1
    9. layer1                                       19. banner
10. autonumber1                                   20. navigation
      http://devfiles.myopera.com/articles/572/idlist-url.htm
Styling HTML5 elements

    article, nav, header, footer
          {display:block;}

document.createElement ('article');

 http://html5shim.googlecode.com/svn/trunk/html5.js
<content> ?
Document Outlines
In HTML5, these are all equivalent
<h1>Today's top stories</h1>

<article>
  <h3>Dog bites man</h3>
  ...

<article>
<h3>Today's top stories</h3>

<article>
  <h6>Dog bites man</h6>
  ...

<article>
<h6>Today's top stories</h6>

<article>
  <h2>Dog bites man</h2>
  ...

<article>
“Sections may contain headings of any rank, but authors
are strongly encouraged to either use only h1 elements, or
to use elements of the appropriate rank for the section's
nesting level.” http://www.w3.org/TR/html5/sections.html#headings-and-sections

<h1>Today's top stories</h1>

 <article>
   <h1>Dog bites man</h1>
   ...

 <article>
Webforms – more powerful form elements
standardise commonly-used
rich form elements – without JavaScript
built-in validation
           (of course you should still validate on the server)

                 <input type=email>
             <input type=url required>
         <input type=range min=10 max=100>
 <input type=date min=2010-01-01 max=2010-12-31>
<input pattern="[0-9][A-Z]{3}" placeholder="9AAA">

     http://people.opera.com/brucel/demo/html5-forms-demo.html
<video>
“...extending the language to better support Web
applications, since that is one of the directions the Web is
going in and is one of the areas least well served by HTML
so far. This puts HTML in direct competition with other
technologies intended for applications deployed over the
Web, in particular Flash and Silverlight.”

Ian Hickson, Editor of HTML5
http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
<object width="425" height="344">
  <param name="movie"
value="http://www.example.com/v/9sEI1AUFJKw&hl=en
&fs=1&"></param>
  <param name="allowFullScreen"
value="true"></param>
  <param name="allowscriptaccess"
value="always"></param>
  <embed
src="http://www.example.com/v/9sEI1AUFJKw&hl=en&f
s=1&" type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true"
width="425" height="344"></embed>
</object>
<video src=video.ogv
  controls
  autoplay
  poster=poster.jpg
  width=320 height=240>
    <a href=video.ogv>Download movie</a>
</video>
video format debates – Free formats vs MP4
<video controls autoplay poster=… width=… height=…>
   <source src=movie.webm type=video/webm>
   <source src=movie.mp4 type=video/mp4>
   <source src=movie.ogv type=video/ogg>
   <!-- fallback content -->
</video>


       still include fallback for old browsers
            http://camendesign.com/code/video_for_everybody
video as native object...why is it important?

● “play nice” with rest of the page
● keyboard accessibility built-in

● API for controls
controlling video with JavaScript
<script>
 /* grab the first video element */
var video = document.getElementsByTagName('video')[0];
 /* remove the browser-supplied controls, cos we're
scripting our own */
video.removeAttribute('controls');
</script>

<video controls>
   <source src=movie.webm type=video/webm>
</video>

<input type=button value="play / pause"
    onclick="if (video.paused) video.play(); else
video.pause()">
video accessibility
<video controls autoplay poster=… width=… height=…>
   <source src=movie.webm type=video/webm>
   <source src=movie.mp4 type=video/mp4>
   <source src=movie.ogv type=video/ogg>

    <track src=subtitles.srt kind=subtitles srclang=en>

   <!-- fallback content -->
</video>

http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-track-element
http://www.delphiki.com/html5/playr/
video media queries
<video controls>
<source src=hi-res.ogv media=”(min-device-width:800px)”>
<source src=lo-res.ogv>
</video>

http://dev.w3.org/html5/spec/video.html#the-source-element
<canvas>
canvas = “scriptable images”
canvas has standard API methods for drawing
ctx = canvas.getContext("2d");

ctx.fillStyle = 'blue';
ctx.fillRect(x, y, width, height);
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x, y);
ctx.bezierCurveTo(x1, y1, x2, y2, c1, c2);
canvas text
ctxt.fillStyle = '#00f';
ctx.font = 'italic 30px sans-serif';
ctx.textBaseline = 'top';
ctx.fillText('Hello world!', 0, 0);
ctx.font = 'bold 30px sans-serif';
ctx.strokeText('Hello world!', 0, 50)
<svg>
   or

<canvas>?
Scalable Vector Graphics:

● Supported in 4 modern browsers, and IE9
● Vector graphics, therefore infinitely scalable

● XML so text-based - can be made accessible

● Keeps a DOM

● Can author with Adobe Illustrator or Inkscape
All things are connected
canvas > “scriptable images”
canvas can mix with external graphics / video
var ctx =
document.querySelector('canvas').getContext('2d'),
img = document.createElement('img');

img.onload = function ()
{
ctx.drawImage(img, 0, 0);
var pixels = ctx.getImageData(0, 0, img.width,
img.height);
...
};
img.src = 'authors.jpg';
canvas can access every pixel
img.onload = function () {
...
var pixels = ctx.getImageData(0, 0, img.width,
  img.height);

for (var i = 0, n = pixels.data.length; i < n;
   i += 4) {
pixels.data[i+0] = 255 - pixels.data[i+0]; // red
pixels.data[i+1] = 255 - pixels.data[i+2]; // green
pixels.data[i+2] = 255 - pixels.data[i+1]; // blue
// i + 3 is the alpha channel which we don’t need
}
ctx.putImageData(pixels, 0, 0);
};
img.src = 'authors.jpg';
canvas and video, sitting in a tree!
var video = document.querySelector('video');
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');

addEvent(video, 'timeupdate', function () {

// ctx.restore();

  ctx.drawImage(video, 0, 0, video.width,
video.height, 0, 0, canvas.width, canvas.height);
});

               http://html5demos.com/video-canvas
http://www.craftymind.com/factory/html5video/CanvasVideo.html
Photo credits

                     Swinging London
http://www.flickr.com/photos/nationalarchives/3008584298/

        Cute NEWT by Rob Winters @Robwinters

                    Sharks with lasers:
http://www.flickr.com/photos/starstreak007/3416655056/

              HTML5 rocks by Alex Sexton
                 Used with permission

                     All others, me
www.opera.com/developer
   bruce.lawson@opera.com
   www.brucelawson.co.uk
       twitter.com/brucel

More Related Content

What's hot

5 single page application principles developers need to know
5 single page application principles developers need to know5 single page application principles developers need to know
5 single page application principles developers need to know
Chris Love
 
High Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowHigh Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slow
Tobias Järlund
 
Lesson learned from 3 years with hybrid apps
Lesson learned from 3 years with hybrid appsLesson learned from 3 years with hybrid apps
Lesson learned from 3 years with hybrid apps
Patrik Malmquist
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010Patrick Lauke
 
Transmission2 25.11.2009
Transmission2 25.11.2009Transmission2 25.11.2009
Transmission2 25.11.2009Patrick Lauke
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Patrick Lauke
 
HTML5 and friends - standards>next Manchester 24.11.2010
HTML5 and friends - standards>next Manchester 24.11.2010HTML5 and friends - standards>next Manchester 24.11.2010
HTML5 and friends - standards>next Manchester 24.11.2010Patrick Lauke
 
Making Chrome Extension with AngularJS
Making Chrome Extension with AngularJSMaking Chrome Extension with AngularJS
Making Chrome Extension with AngularJS
Ben Lau
 
10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer
Chris Love
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Zi Bin Cheah
 
Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.
Chad Carstensen
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development CareerEunus Hosen
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015
dmethvin
 
Intro to Web Development
Intro to Web DevelopmentIntro to Web Development
[jqconatx] Adaptive Images for Responsive Web Design
[jqconatx] Adaptive Images for Responsive Web Design[jqconatx] Adaptive Images for Responsive Web Design
[jqconatx] Adaptive Images for Responsive Web DesignChristopher Schmitt
 
HTML / CSS / JS Web basics
HTML / CSS / JS Web basicsHTML / CSS / JS Web basics
HTML / CSS / JS Web basics
btopro
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slow
dmethvin
 
Building fast webapps, fast - Velocity 2010
Building fast webapps, fast - Velocity 2010Building fast webapps, fast - Velocity 2010
Building fast webapps, fast - Velocity 2010
marcuswestin
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build
Monika Piotrowicz
 
Web components api + Vuejs
Web components api + VuejsWeb components api + Vuejs
Web components api + Vuejs
Mikhail Kuznetcov
 

What's hot (20)

5 single page application principles developers need to know
5 single page application principles developers need to know5 single page application principles developers need to know
5 single page application principles developers need to know
 
High Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowHigh Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slow
 
Lesson learned from 3 years with hybrid apps
Lesson learned from 3 years with hybrid appsLesson learned from 3 years with hybrid apps
Lesson learned from 3 years with hybrid apps
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
 
Transmission2 25.11.2009
Transmission2 25.11.2009Transmission2 25.11.2009
Transmission2 25.11.2009
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
 
HTML5 and friends - standards>next Manchester 24.11.2010
HTML5 and friends - standards>next Manchester 24.11.2010HTML5 and friends - standards>next Manchester 24.11.2010
HTML5 and friends - standards>next Manchester 24.11.2010
 
Making Chrome Extension with AngularJS
Making Chrome Extension with AngularJSMaking Chrome Extension with AngularJS
Making Chrome Extension with AngularJS
 
10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer10 things to make you a Great Mobile Web Developer
10 things to make you a Great Mobile Web Developer
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
 
Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015
 
Intro to Web Development
Intro to Web DevelopmentIntro to Web Development
Intro to Web Development
 
[jqconatx] Adaptive Images for Responsive Web Design
[jqconatx] Adaptive Images for Responsive Web Design[jqconatx] Adaptive Images for Responsive Web Design
[jqconatx] Adaptive Images for Responsive Web Design
 
HTML / CSS / JS Web basics
HTML / CSS / JS Web basicsHTML / CSS / JS Web basics
HTML / CSS / JS Web basics
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slow
 
Building fast webapps, fast - Velocity 2010
Building fast webapps, fast - Velocity 2010Building fast webapps, fast - Velocity 2010
Building fast webapps, fast - Velocity 2010
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build
 
Web components api + Vuejs
Web components api + VuejsWeb components api + Vuejs
Web components api + Vuejs
 

Viewers also liked

Satelites
SatelitesSatelites
Satelites
Leydi Cardenas
 
Procedimiento examen de recuperacion
Procedimiento examen de recuperacionProcedimiento examen de recuperacion
Procedimiento examen de recuperacionAngel Barrios
 
Development and Evaluation of Energy-Efficient and Adaptive Protocols for Wi...
Development and Evaluation of Energy-Efficient and Adaptive Protocolsfor Wi...Development and Evaluation of Energy-Efficient and Adaptive Protocolsfor Wi...
Development and Evaluation of Energy-Efficient and Adaptive Protocols for Wi...
Torsten Braun, Universität Bern
 
Configuracion de rockolas 2014
Configuracion de rockolas 2014Configuracion de rockolas 2014
Configuracion de rockolas 2014
Yoni Banda
 
Seminario di web content - Scheda corso LEN
Seminario di web content - Scheda corso LENSeminario di web content - Scheda corso LEN
Seminario di web content - Scheda corso LEN
LEN Learning Education Network
 
Factoring: Liquidez inmediata para crecer
Factoring: Liquidez inmediata para crecerFactoring: Liquidez inmediata para crecer
Factoring: Liquidez inmediata para crecerGermán Lynch Navarro
 
Choosing a conductivity salinity logger part 2 of 2
Choosing a conductivity salinity logger part 2 of 2Choosing a conductivity salinity logger part 2 of 2
Choosing a conductivity salinity logger part 2 of 2
HOBO Data Loggers
 
Play faster and longer: How Square Enix maximized Android* performance and ba...
Play faster and longer: How Square Enix maximized Android* performance and ba...Play faster and longer: How Square Enix maximized Android* performance and ba...
Play faster and longer: How Square Enix maximized Android* performance and ba...
Gael Hofemeier
 
Charla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
Charla Presentacion Libro GRAFITICA: Grafica Popular CostarricenseCharla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
Charla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
Caro Goodfellow
 
Training iso dan konsultan iso di selenggarakan oleh bmd street consulting
Training iso dan konsultan iso di selenggarakan oleh bmd street consultingTraining iso dan konsultan iso di selenggarakan oleh bmd street consulting
Training iso dan konsultan iso di selenggarakan oleh bmd street consulting
Abu Yazid
 
Manual de edmodo aula de tecnología
Manual de edmodo   aula de tecnologíaManual de edmodo   aula de tecnología
Manual de edmodo aula de tecnología
Guisella Jimenez
 
Guide for intensive intervention
Guide for intensive interventionGuide for intensive intervention
Guide for intensive interventionjsbartecchi
 
Introduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsIntroduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ students
Lulu Pachuau
 
Horarios y Recorridos Semana Santa Pedro Abad 2016
Horarios y Recorridos Semana Santa Pedro Abad 2016Horarios y Recorridos Semana Santa Pedro Abad 2016
Horarios y Recorridos Semana Santa Pedro Abad 2016
jumamudi74
 
Libro de judit
Libro de juditLibro de judit
Libro de judit
Humberto Castro
 
Introduciendo el proyecto Endesa E3 (castellano)
Introduciendo el proyecto Endesa E3 (castellano)Introduciendo el proyecto Endesa E3 (castellano)
Introduciendo el proyecto Endesa E3 (castellano)
Endesa Educa
 
Lengua vasca
Lengua vascaLengua vasca
Lengua vasca
Fva Juan de Garay
 

Viewers also liked (20)

Satelites
SatelitesSatelites
Satelites
 
Procedimiento examen de recuperacion
Procedimiento examen de recuperacionProcedimiento examen de recuperacion
Procedimiento examen de recuperacion
 
Development and Evaluation of Energy-Efficient and Adaptive Protocols for Wi...
Development and Evaluation of Energy-Efficient and Adaptive Protocolsfor Wi...Development and Evaluation of Energy-Efficient and Adaptive Protocolsfor Wi...
Development and Evaluation of Energy-Efficient and Adaptive Protocols for Wi...
 
Configuracion de rockolas 2014
Configuracion de rockolas 2014Configuracion de rockolas 2014
Configuracion de rockolas 2014
 
Seminario di web content - Scheda corso LEN
Seminario di web content - Scheda corso LENSeminario di web content - Scheda corso LEN
Seminario di web content - Scheda corso LEN
 
Factoring: Liquidez inmediata para crecer
Factoring: Liquidez inmediata para crecerFactoring: Liquidez inmediata para crecer
Factoring: Liquidez inmediata para crecer
 
Choosing a conductivity salinity logger part 2 of 2
Choosing a conductivity salinity logger part 2 of 2Choosing a conductivity salinity logger part 2 of 2
Choosing a conductivity salinity logger part 2 of 2
 
IceSpy Demo
IceSpy DemoIceSpy Demo
IceSpy Demo
 
Play faster and longer: How Square Enix maximized Android* performance and ba...
Play faster and longer: How Square Enix maximized Android* performance and ba...Play faster and longer: How Square Enix maximized Android* performance and ba...
Play faster and longer: How Square Enix maximized Android* performance and ba...
 
Charla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
Charla Presentacion Libro GRAFITICA: Grafica Popular CostarricenseCharla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
Charla Presentacion Libro GRAFITICA: Grafica Popular Costarricense
 
Training iso dan konsultan iso di selenggarakan oleh bmd street consulting
Training iso dan konsultan iso di selenggarakan oleh bmd street consultingTraining iso dan konsultan iso di selenggarakan oleh bmd street consulting
Training iso dan konsultan iso di selenggarakan oleh bmd street consulting
 
Manual de edmodo aula de tecnología
Manual de edmodo   aula de tecnologíaManual de edmodo   aula de tecnología
Manual de edmodo aula de tecnología
 
Guide for intensive intervention
Guide for intensive interventionGuide for intensive intervention
Guide for intensive intervention
 
Introduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsIntroduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ students
 
Horarios y Recorridos Semana Santa Pedro Abad 2016
Horarios y Recorridos Semana Santa Pedro Abad 2016Horarios y Recorridos Semana Santa Pedro Abad 2016
Horarios y Recorridos Semana Santa Pedro Abad 2016
 
Libro de judit
Libro de juditLibro de judit
Libro de judit
 
T espe-021852
T espe-021852T espe-021852
T espe-021852
 
Ud Judo
Ud JudoUd Judo
Ud Judo
 
Introduciendo el proyecto Endesa E3 (castellano)
Introduciendo el proyecto Endesa E3 (castellano)Introduciendo el proyecto Endesa E3 (castellano)
Introduciendo el proyecto Endesa E3 (castellano)
 
Lengua vasca
Lengua vascaLengua vasca
Lengua vasca
 

Similar to Disruptive code

Html5 oslo-code-camp
Html5 oslo-code-campHtml5 oslo-code-camp
Html5 oslo-code-camp
brucelawson
 
HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why howbrucelawson
 
HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010
Patrick Lauke
 
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011Patrick Lauke
 
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010Patrick Lauke
 
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011Patrick Lauke
 
HTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a treeHTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a tree
brucelawson
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
brucelawson
 
Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~
Sho Ito
 
HTML 5 - Overview
HTML 5 - OverviewHTML 5 - Overview
HTML 5 - Overview
Marcelio Leal
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
Todd Anglin
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Sadaaki HIRAI
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaLeave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaRobert Nyman
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
Jens-Christian Fischer
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)
Mandakini Kumari
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
Nathan Smith
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
ACCESS
 
The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5
Todd Anglin
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBob Paulin
 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
Michael Enslow
 

Similar to Disruptive code (20)

Html5 oslo-code-camp
Html5 oslo-code-campHtml5 oslo-code-camp
Html5 oslo-code-camp
 
HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
 
HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010
 
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011
Schöne neue Welt von HTML5 - MultimediaTreff 28 - Köln 03.12.2011
 
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
 
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
 
HTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a treeHTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a tree
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
 
Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~
 
HTML 5 - Overview
HTML 5 - OverviewHTML 5 - Overview
HTML 5 - Overview
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaLeave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
 
The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
 

More from brucelawson

Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
brucelawson
 
HTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're goingHTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're going
brucelawson
 
Leveraging HTML 5.0
Leveraging HTML 5.0Leveraging HTML 5.0
Leveraging HTML 5.0
brucelawson
 
HTML5 Multimedia Accessibility
HTML5 Multimedia AccessibilityHTML5 Multimedia Accessibility
HTML5 Multimedia Accessibility
brucelawson
 
HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingHTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're going
brucelawson
 
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScriptWeb Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
brucelawson
 
Bruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japanBruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japanbrucelawson
 
HTML5 and CSS 3
HTML5 and CSS 3HTML5 and CSS 3
HTML5 and CSS 3
brucelawson
 
Bruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek MeetBruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek Meetbrucelawson
 
Bruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentationBruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentation
brucelawson
 
Practical Tips for Mobile Widget development
Practical Tips for Mobile Widget developmentPractical Tips for Mobile Widget development
Practical Tips for Mobile Widget development
brucelawson
 
Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?
brucelawson
 

More from brucelawson (12)

Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
 
HTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're goingHTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're going
 
Leveraging HTML 5.0
Leveraging HTML 5.0Leveraging HTML 5.0
Leveraging HTML 5.0
 
HTML5 Multimedia Accessibility
HTML5 Multimedia AccessibilityHTML5 Multimedia Accessibility
HTML5 Multimedia Accessibility
 
HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingHTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're going
 
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScriptWeb Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
 
Bruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japanBruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japan
 
HTML5 and CSS 3
HTML5 and CSS 3HTML5 and CSS 3
HTML5 and CSS 3
 
Bruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek MeetBruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek Meet
 
Bruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentationBruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentation
 
Practical Tips for Mobile Widget development
Practical Tips for Mobile Widget developmentPractical Tips for Mobile Widget development
Practical Tips for Mobile Widget development
 
Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?
 

Disruptive code

  • 1. The Zen of HTML5 Bruce Lawson, Opera Software Disruptive Code / Stockholm / 21 September 2010
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 9.
  • 10.
  • 11. © Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. You are granted a license to use, reproduce and create derivative works of this document.
  • 12.
  • 13.
  • 15.
  • 17. SVG
  • 18. CSS
  • 19. New Exciting Web Technology
  • 20.
  • 21. HTML5 does not replace HTML 4.01
  • 22. HTML5 has more bling!
  • 23. HTML5 is umbrella term: markup elements and JavaScript APIs
  • 24. 28 new elements (or maybe 29)
  • 25.
  • 26. Top 20 class names 1. footer 11. button 2. menu 12. main 3. style1 13. style3 4. msonormal 14. small 5. text 15. nav 6. content 16. clear 7. title 17. search 8. style2 18. style4 9. header 19. logo 10. copyright 20. body http://devfiles.myopera.com/articles/572/classlist-url.htm
  • 27. Top 20 id names 1. footer 11. search 2. content 12. nav 3. header 13. wrapper 4. logo 14. top 5. container 15. table2 6. main 16. layer2 7. table1 17. sidebar 8. menu 18. image1 9. layer1 19. banner 10. autonumber1 20. navigation http://devfiles.myopera.com/articles/572/idlist-url.htm
  • 28.
  • 29. Styling HTML5 elements article, nav, header, footer {display:block;} document.createElement ('article'); http://html5shim.googlecode.com/svn/trunk/html5.js
  • 30.
  • 31.
  • 33.
  • 34.
  • 35.
  • 37. In HTML5, these are all equivalent <h1>Today's top stories</h1> <article> <h3>Dog bites man</h3> ... <article>
  • 38. <h3>Today's top stories</h3> <article> <h6>Dog bites man</h6> ... <article>
  • 39. <h6>Today's top stories</h6> <article> <h2>Dog bites man</h2> ... <article>
  • 40. “Sections may contain headings of any rank, but authors are strongly encouraged to either use only h1 elements, or to use elements of the appropriate rank for the section's nesting level.” http://www.w3.org/TR/html5/sections.html#headings-and-sections <h1>Today's top stories</h1> <article> <h1>Dog bites man</h1> ... <article>
  • 41. Webforms – more powerful form elements
  • 42.
  • 43. standardise commonly-used rich form elements – without JavaScript
  • 44. built-in validation (of course you should still validate on the server) <input type=email> <input type=url required> <input type=range min=10 max=100> <input type=date min=2010-01-01 max=2010-12-31> <input pattern="[0-9][A-Z]{3}" placeholder="9AAA"> http://people.opera.com/brucel/demo/html5-forms-demo.html
  • 46. “...extending the language to better support Web applications, since that is one of the directions the Web is going in and is one of the areas least well served by HTML so far. This puts HTML in direct competition with other technologies intended for applications deployed over the Web, in particular Flash and Silverlight.” Ian Hickson, Editor of HTML5 http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
  • 47. <object width="425" height="344"> <param name="movie" value="http://www.example.com/v/9sEI1AUFJKw&hl=en &fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.example.com/v/9sEI1AUFJKw&hl=en&f s=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object>
  • 48. <video src=video.ogv controls autoplay poster=poster.jpg width=320 height=240> <a href=video.ogv>Download movie</a> </video>
  • 49. video format debates – Free formats vs MP4 <video controls autoplay poster=… width=… height=…> <source src=movie.webm type=video/webm> <source src=movie.mp4 type=video/mp4> <source src=movie.ogv type=video/ogg> <!-- fallback content --> </video> still include fallback for old browsers http://camendesign.com/code/video_for_everybody
  • 50. video as native object...why is it important? ● “play nice” with rest of the page ● keyboard accessibility built-in ● API for controls
  • 51. controlling video with JavaScript <script> /* grab the first video element */ var video = document.getElementsByTagName('video')[0]; /* remove the browser-supplied controls, cos we're scripting our own */ video.removeAttribute('controls'); </script> <video controls> <source src=movie.webm type=video/webm> </video> <input type=button value="play / pause" onclick="if (video.paused) video.play(); else video.pause()">
  • 52. video accessibility <video controls autoplay poster=… width=… height=…> <source src=movie.webm type=video/webm> <source src=movie.mp4 type=video/mp4> <source src=movie.ogv type=video/ogg> <track src=subtitles.srt kind=subtitles srclang=en> <!-- fallback content --> </video> http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-track-element http://www.delphiki.com/html5/playr/
  • 53. video media queries <video controls> <source src=hi-res.ogv media=”(min-device-width:800px)”> <source src=lo-res.ogv> </video> http://dev.w3.org/html5/spec/video.html#the-source-element
  • 56. canvas has standard API methods for drawing ctx = canvas.getContext("2d"); ctx.fillStyle = 'blue'; ctx.fillRect(x, y, width, height); ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y); ctx.bezierCurveTo(x1, y1, x2, y2, c1, c2);
  • 57. canvas text ctxt.fillStyle = '#00f'; ctx.font = 'italic 30px sans-serif'; ctx.textBaseline = 'top'; ctx.fillText('Hello world!', 0, 0); ctx.font = 'bold 30px sans-serif'; ctx.strokeText('Hello world!', 0, 50)
  • 58. <svg> or <canvas>?
  • 59. Scalable Vector Graphics: ● Supported in 4 modern browsers, and IE9 ● Vector graphics, therefore infinitely scalable ● XML so text-based - can be made accessible ● Keeps a DOM ● Can author with Adobe Illustrator or Inkscape
  • 60. All things are connected
  • 62.
  • 63. canvas can mix with external graphics / video var ctx = document.querySelector('canvas').getContext('2d'), img = document.createElement('img'); img.onload = function () { ctx.drawImage(img, 0, 0); var pixels = ctx.getImageData(0, 0, img.width, img.height); ... }; img.src = 'authors.jpg';
  • 64. canvas can access every pixel img.onload = function () { ... var pixels = ctx.getImageData(0, 0, img.width, img.height); for (var i = 0, n = pixels.data.length; i < n; i += 4) { pixels.data[i+0] = 255 - pixels.data[i+0]; // red pixels.data[i+1] = 255 - pixels.data[i+2]; // green pixels.data[i+2] = 255 - pixels.data[i+1]; // blue // i + 3 is the alpha channel which we don’t need } ctx.putImageData(pixels, 0, 0); }; img.src = 'authors.jpg';
  • 65.
  • 66. canvas and video, sitting in a tree! var video = document.querySelector('video'); var canvas = document.querySelector('canvas'); var ctx = canvas.getContext('2d'); addEvent(video, 'timeupdate', function () { // ctx.restore(); ctx.drawImage(video, 0, 0, video.width, video.height, 0, 0, canvas.width, canvas.height); }); http://html5demos.com/video-canvas
  • 68.
  • 69.
  • 70.
  • 71. Photo credits Swinging London http://www.flickr.com/photos/nationalarchives/3008584298/ Cute NEWT by Rob Winters @Robwinters Sharks with lasers: http://www.flickr.com/photos/starstreak007/3416655056/ HTML5 rocks by Alex Sexton Used with permission All others, me
  • 72. www.opera.com/developer bruce.lawson@opera.com www.brucelawson.co.uk twitter.com/brucel