a practical guide to html5

76

Upload: harvard-web-working-group

Post on 06-May-2015

2.132 views

Category:

Design


3 download

DESCRIPTION

"A Practical Guide to HTML5" was delivered by Mat Marquis (@wilto) of Marquis Design on May 11th, 2011 at Harvard University's Lamont Library Forum Room.

TRANSCRIPT

Page 1: A Practical Guide to HTML5
Page 2: A Practical Guide to HTML5

WE’RE SPENDING AN HOUR ON EXISTENTIALISM. HOPE YOU BROUGHT A SNACK.

Page 3: A Practical Guide to HTML5

[email protected]/

github.com/

twitter.com/

MARQUISMAT “WILTO”

wilto

wilto

wilto

Page 4: A Practical Guide to HTML5

IF ANYONE MENTIONS THE MARQUEE TAG THEY WILL BE ASKED TO LEAVE.

Page 5: A Practical Guide to HTML5

• New semantically-rich markup•

Page 6: A Practical Guide to HTML5

New semantically-rich markup•

Changes to the markup you know and love

Page 7: A Practical Guide to HTML5

New semantically-rich markup•

APIs that can access device-specific features•

Changes to the markup you know and love

Page 8: A Practical Guide to HTML5

New semantically-rich markup•

APIs that can access device-specific features•

Changes to the markup you know and love

APIs for caching and storing items in the browser

Page 9: A Practical Guide to HTML5

New semantically-rich markup•

APIs that can access device-specific features•

Changes to the markup you know and love

• CSS3

APIs for caching and storing items in the browser

Page 10: A Practical Guide to HTML5

New semantically-rich markup•

APIs that can access device-specific features•

Changes to the markup you know and love

• CSS3

APIs for caching and storing items in the browser

Page 11: A Practical Guide to HTML5

““ HTML5 DOES NOT INCLUDE JAVASCRIPT APIS, CSS3,

AMPERSANDS, OR CAT PICTURES!

Page 12: A Practical Guide to HTML5

SHOULDN’T YOU BE MAKING WEBSITES RIGHT NOW?

Page 13: A Practical Guide to HTML5

REMEMBER “CAPTAIN PLANET?” LIKE THAT, BUT WITHOUT THE MULLET.

Page 14: A Practical Guide to HTML5

EVERYTHING MAKES SENSE NOW.

Page 15: A Practical Guide to HTML5

SECTIONING ELEMENTS

<nav>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

<section><aside>

<article>

<section>

Page 16: A Practical Guide to HTML5

The header element represents a group of introductory or navigational aids.

<nav>

<footer>

<aside>

<header>

SECTIONING ELEMENTSheadernavarticlesectionasidefooter

<section><aside>

<article>

<section>

Page 17: A Practical Guide to HTML5

The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links.

<nav>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

SECTIONING ELEMENTS

<section><aside>

<article>

<section>

Page 18: A Practical Guide to HTML5

The article element represents a self-contained document, page, application, or widget which is fit for syndication.

<nav>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

SECTIONING ELEMENTS

<section><aside>

<article>

<section>

Page 19: A Practical Guide to HTML5

The section element represents a thematic grouping of content.

<nav>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

SECTIONING ELEMENTS

<section><aside>

<article>

<section>

Page 20: A Practical Guide to HTML5

The aside element represents content that is related to the surrounding document/article, but could be considered separate from that content.

<nav>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

SECTIONING ELEMENTS

<section><aside>

<article>

<section>

Page 21: A Practical Guide to HTML5

The footer element typically contains information about its section, such as authors, links to related documents, copyright information, etc.

<nav>

<section><aside>

<footer>

<aside>

<header>headernavarticlesectionasidefooter

SECTIONING ELEMENTS

<article>

<section>

Page 22: A Practical Guide to HTML5

• untitled header

•untitled document

• untitled nav

• untitled article

• untitled aside

• untitled footer

• untitled aside

• untitled section

DOCUMENT OUTLINE

• untitled section

Page 23: A Practical Guide to HTML5

• untitled header

•untitled document

• untitled nav

• untitled article

• untitled aside

• untitled footer

• untitled aside

• untitled section

DOCUMENT OUTLINE

• untitled section

Page 24: A Practical Guide to HTML5

<h1> Lorem ipsum dolor </h1>

<section><h1> Chapter One </h1><h2> In the Beginning </h2><p> ... </p><h2> Meanwhile, Back at the Ranch </h2><p> ... </p>

</section>

<section><h1> Chapter Two </h1><p> ... </p>

</section>

<aside><blockquote> <p> ... </p> </blockquote>

</aside>

<article>

</article>

Page 25: A Practical Guide to HTML5

<h1> Lorem ipsum dolor </h1>

<section><h1> Chapter One </h1><h2> In the Beginning </h2><p> ... </p><h2> Meanwhile, Back at the Ranch </h2><p> ... </p>

</section>

<section><h1> Chapter Two </h1><p> ... </p>

</section>

<aside><blockquote> <p> ... </p> </blockquote>

</aside>

<article>

</article>

Page 26: A Practical Guide to HTML5

<h1> Lorem ipsum dolor </h1>

<section><h1> Chapter One </h1><h2> In the Beginning </h2><p> ... </p><h2> Meanwhile, Back at the Ranch </h2><p> ... </p>

</section>

<section><h1> Chapter Two </h1><p> ... </p>

</section>

<aside><blockquote> <p> ... </p> </blockquote>

</aside>

<article>

</article>

Page 27: A Practical Guide to HTML5

<section><h1> Chapter One </h1><h2> In the Beginning </h2><p> ... </p><h2> Meanwhile, Back at the Ranch </h2><p> ... </p>

</section>

<section><h1> Chapter Two </h1><p> ... </p>

</section>

<aside><blockquote> <p> ... </p> </blockquote>

</aside>

<article>

</article>

<h1> Lorem ipsum dolor </h1>

Page 28: A Practical Guide to HTML5

• untitled header

•untitled document

• untitled nav

• Lorem Ipsum Dolor

• untitled aside

• untitled footer

• untitled aside

• Chapter One

DOCUMENT OUTLINE

• In The Beginning

• Meanwhile, Back at the Ranch

• Chapter Two

Page 29: A Practical Guide to HTML5

• untitled header

•untitled document

• untitled nav

• Lorem Ipsum Dolor

• untitled aside

• untitled footer

• untitled aside

• Chapter One

DOCUMENT OUTLINE

• In The Beginning

• Meanwhile, Back at the Ranch

• Chapter Two

http://wil.to/html5/2

HTML5 Outliner for ChromeGenerates a navigable page outline with heading and sectioning elements.

Page 30: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

MORE NEW HOTNESS

Page 31: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

progressRepresents the completion progress of a task within a known range.<progress max="100">80%</meter> complete.

MORE NEW HOTNESS

Page 32: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

progressRepresents the completion progress of a task within a known range.<progress max="100">80%</meter> complete.

timeRepresents dates and times in a machine-readable way.On <time datetime="2010-05-24T02:55:30-04:00">May 24th 2010, 2:55am EDT</time>.

MORE NEW HOTNESS

Page 33: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

progressRepresents the completion progress of a task within a known range.<progress max="100">80%</meter> complete.

timeRepresents dates and times in a machine-readable way.On <time datetime="2010-05-24T02:55:30-04:00">May 24th 2010, 2:55am EDT</time>.

outputRepresents the result of a calculation.<input type="number" value="2"/> + <input type="number" value="2"/> = <output>4</output>

MORE NEW HOTNESS

Page 34: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

progressRepresents the completion progress of a task within a known range.<progress max="100">80%</meter> complete.

timeRepresents dates and times in a machine-readable way.On <time datetime="2010-05-24T02:55:30-04:00">May 24th 2010, 2:55am EDT</time>.

outputRepresents the result of a calculation.<input type="number" value="2"/> + <input type="number" value="2"/> = <output>4</output>

blinkIs gone, and if I ever catch you using it again so help me, guys.

MORE NEW HOTNESS

Page 35: A Practical Guide to HTML5

meterRepresents a scalar measurement within a known range, or a fractional value. <meter>2 of 6 gigabytes</meter> used.

progressRepresents the completion progress of a task within a known range.<progress max="100">80%</meter> complete.

timeRepresents dates and times in a machine-readable way.On <time datetime="2010-05-24T02:55:30-04:00">May 24th 2010, 2:55am EDT</time>.

outputRepresents the result of a calculation.<input type="number" value="2"/> + <input type="number" value="2"/> = <output>4</output>

blinkIs gone, and if I ever catch you using it again so help me, guys.

MORE NEW HOTNESS

http://developers.whatwg.org/

The HTML5 Spec for Web DevelopersFormatted for readability and quick access to information.

Page 36: A Practical Guide to HTML5
Page 37: A Practical Guide to HTML5

YOU KNEW IT WOULD COME UP EVENTUALLY

Page 38: A Practical Guide to HTML5

YOU KNEW IT WOULD COME UP EVENTUALLY

http://wil.to/html5/3

HTML5 Support in IE 6/7/8Remy Sharp’s HTML5-enabling script for Internet Explorer.

Page 39: A Practical Guide to HTML5

REPURPOSED ELEMENTS<dl>, <dt>, and <dd>An association list consisting of zero or more key-value groups.

<dl> <dt>Full Name:</dt> <dd>John Smith</dd> <dt>Occupation:</dt> <dd>Doctor</dd></dt>

Page 40: A Practical Guide to HTML5

REPURPOSED ELEMENTS<b>Text stylistically offset from the surrounding text without extra importance.

<b class="drop-cap">S</b>herlock Holmes, who was usually late…

Page 41: A Practical Guide to HTML5

REPURPOSED ELEMENTS<small>“Small print,” as in disclaimers, caveats, legal restrictions, or copyrights.

<small>Copyright Mat “Wilto” Marquis, 2010</small>

Page 42: A Practical Guide to HTML5

REPURPOSED ELEMENTS<cite>Represents the title of a work (a book, song, film, etc.)—but not a person’s name.

<p>I don’t quite agree with the <cite>HTML5 spec</cite> here.</p>

Page 43: A Practical Guide to HTML5

REPURPOSED ELEMENTS<address>Contact information for the current article or document—not a postal address.

<address>Posted by: <a href="http://twitter.com/wilto">Mat</a></address>

Page 44: A Practical Guide to HTML5

STOP ME IF YOU’VE HEARD OF THIS ONE

Page 45: A Practical Guide to HTML5
Page 46: A Practical Guide to HTML5

BORDER-RADIUS

Page 47: A Practical Guide to HTML5

BOX-SHADOW

Page 48: A Practical Guide to HTML5

NOT PARTICULARLY EXCITING

Page 49: A Practical Guide to HTML5

VENDOR PREFIXES

Page 50: A Practical Guide to HTML5

VENDOR PREFIXES• -webkit-

Page 51: A Practical Guide to HTML5

VENDOR PREFIXES•

-webkit-

-moz-

Page 52: A Practical Guide to HTML5

VENDOR PREFIXES•

-webkit-

-moz-• -o-

Page 53: A Practical Guide to HTML5

VENDOR PREFIXES•

-webkit-

-moz-•

-o-

-ms-

Page 54: A Practical Guide to HTML5

TRANSITIONSa { color: #777; -webkit-transition: color .2s linear; -moz-transition: color .2s linear; -ms-transition: color .2s linear; -o-transition: color .2s linear; transition: color .2s linear;}a:hover { color: #bada55;}

Page 55: A Practical Guide to HTML5

TRANSITIONSa { color: #777; -webkit-transition: color .2s linear; -moz-transition: color .2s linear; -ms-transition: color .2s linear; -o-transition: color .2s linear; transition: color .2s linear;}a:hover { color: #bada55;}http://wil.to/html5/transitions

Transition Demo

Page 56: A Practical Guide to HTML5

GRADIENTSbackground: -moz-linear-gradient( top, #1e5799 0%, #7db9e8 100% );background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8) );background: -o-linear-gradient( top, #1e5799 0%, #7db9e8 100% );

Page 57: A Practical Guide to HTML5

GRADIENTS

background: -moz-linear-gradient( top, #1e5799 0%, #7db9e8 100% );background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8) );background: -o-linear-gradient( top, #1e5799 0%, #7db9e8 100% );

background: #1e5799 url(img/gradient.jpg);

Page 58: A Practical Guide to HTML5

background: -moz-linear-gradient( top, #1e5799 0%, #7db9e8 100% );background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8) );background: -o-linear-gradient( top, #1e5799 0%, #7db9e8 100% );

background: #1e5799 url(img/gradient.jpg);

GRADIENTS

http://wil.to/html5/6

CSS3 Gradient GeneratorA tool to generate the appropriate vendor-prefixed gradient syntax.

Page 59: A Practical Guide to HTML5

background: -moz-linear-gradient( top, #1e5799 0%, #7db9e8 100% );background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8) );background: -o-linear-gradient( top, #1e5799 0%, #7db9e8 100% );

background: #1e5799 url(img/gradient.jpg);

GRADIENTS

http://wil.to/html5/gradients/

CSS3 Gradient Demo

Page 60: A Practical Guide to HTML5

FONT-FACE@font-face { font-family: 'AllerBold'; src: url('aller_bd-webfont.eot'); src: url('aller_bd-webfont.eot?#iefix') format('embedded-opentype'), url('aller_bd-webfont.woff') format('woff'), url('aller_bd-webfont.ttf') format('truetype'), url('aller_bd-webfont.svg#AllerBold') format('svg');}

Page 61: A Practical Guide to HTML5

FONT-FACE@font-face { font-family: 'AllerBold'; src: url('aller_bd-webfont.eot'); src: url('aller_bd-webfont.eot?#iefix') format('embedded-opentype'), url('aller_bd-webfont.woff') format('woff'), url('aller_bd-webfont.ttf') format('truetype'), url('aller_bd-webfont.svg#AllerBold') format('svg');}http://www.fontsquirrel.com/

Font SquirrelA repository of free and @font-face licensed fonts, as well as a toolto generate the appropriate @font-face syntax.

Page 62: A Practical Guide to HTML5

FONT-FACE@font-face { font-family: 'AllerBold'; src: url('aller_bd-webfont.eot'); src: url('aller_bd-webfont.eot?#iefix') format('embedded-opentype'), url('aller_bd-webfont.woff') format('woff'), url('aller_bd-webfont.ttf') format('truetype'), url('aller_bd-webfont.svg#AllerBold') format('svg');}http://wil.to/html5/font-face

@font-face demo

Page 63: A Practical Guide to HTML5

GO-GO-GADGET: AWESOME.

Page 64: A Practical Guide to HTML5

GEOLOCATIONfunction geo( position ) { alert( 'Latitude: ' + position.coords.latitude ); alert( 'Longitude: ' + position.coords.longitude );}navigator.geolocation.getCurrentPosition( geo );

Page 65: A Practical Guide to HTML5

GEOLOCATIONfunction geo( position ) { alert( 'Latitude: ' + position.coords.latitude ); alert( 'Longitude: ' + position.coords.longitude );}navigator.geolocation.getCurrentPosition( geo );

http://wtfmbta.com/

Geolocation DemoWaiting There Forever: My Bus Tracking App.

Page 66: A Practical Guide to HTML5

DEVICE ORIENTATIONfunction orientation( event ) { var rotation = event.gamma * -.8, scale = ( event.beta / 180 ) * 2.25 + 1; alert( 'Rotation: ' + rotation + ' Scale: ' + scale );}window.addEventListener('deviceorientation', orientation );

Page 67: A Practical Guide to HTML5

DEVICE ORIENTATIONfunction orientation( event ) { var rotation = event.gamma * -.8, scale = ( event.beta / 180 ) * 2.25 + 1; alert( 'Rotation: ' + rotation + ' Scale: ' + scale );}window.addEventListener('deviceorientation', orientation );

http://wil.to/html5/device-orientation

Device Orientation Demo

Page 68: A Practical Guide to HTML5

HAVE YOU GUYS EVER BEEN “OFFLINE?” IT’S SCARY.

Page 69: A Practical Guide to HTML5

LOCAL STORAGElocalStorage.setItem('variableName', true)

alert( localStorage.getItem('variableName') );// It’s that easy.

Page 70: A Practical Guide to HTML5

LOCAL STORAGElocalStorage.setItem('variableName', true)

alert( localStorage.getItem('variableName') );// It’s that easy.

http://wil.to/html5/local-storage

Local Storage DemoA to-do list app using the localStorage API.

Page 71: A Practical Guide to HTML5
Page 72: A Practical Guide to HTML5

http://www.modernizr.com/

ModernizrA library of tests to check for CSS3 and HTML5 API support on the client side.

Page 73: A Practical Guide to HTML5
Page 74: A Practical Guide to HTML5

http://wil.to/html5/4

Cross Browser PolyfillsBringing HTML5 APIs to browsers that don't natively support them.

Page 75: A Practical Guide to HTML5

YOU MAY NOW ADD “HTML5 GURU” TO YOUR RESUME.

Page 76: A Practical Guide to HTML5

RESOURCES

http://wil.to/html5http://developers.whatwg.orgpester me on the internet (@wilto)