Starting Up withHTML5

What is HTML5

HTML5 is a misnomer!

What people mean by HTML5

The W3C HTML5 spec

HTML5 Markup

HTML5 syntax & parser

Less redundant syntax

Basic HTML5 document

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8"/>
  <title>Hello, world</title>
</head>
<body>
  <p>Hello, world!</p>
</body>
</html>

Minimal syntax

<!DOCTYPE html>
<meta charset=UTF-8>
<title>Hello, world</title>
<p>Hello, world!

Maybe not the best for writing, but good for serving. Minimize your HTML5 with mod_pagespeed

Default attribute values

<script>
<style>
<link rel=stylesheet
    href=styles.css>
<input>

New HTML elements

New HTML elements

HTML5 Multimedia

<audio> and <video>

Audio & video formats

Many sources for multimedia

<video controls>
  <source src="nggyu.webm">
  <source src="nggyu.mp4">
</video>

Video Solutions:

Video examples

Canvas

An element that JavaScript can draw on

<canvas width="500" 
    height="400">
…fallback content here…
</canvas>

Contexts (outside HTML5):

Canvas API and 2d context

var canvas=$("canvas")[0],
    ctx=canvas.getContext("2d");

ctx.fillStyle = 
  "rgba(255, 0, 0, 0.5)";
ctx.fillRect(x, y, w, h);

Demo

Canvas examples

Content sectioning and grouping

Sections in a typical blog

HTML5 Forms & UI

HTML5 Forms

New input types

Demo
<input type=email>
<input type=tel>

Multi-file upload

<progress> & <meter>

<progress value="250"
  max="1000">
  25 out of 1000
</progress>
<meter min=0 max=100 value=25>
25%</meter>
Demo

Pros and cons of new input types

GOOD: Unsupported degrade to text.

BAD: Bad support worse than no support.

Advice: for now, use the ones that are text-like (email, tel, url)

wufoo.com has a nice support table

Form validation

APIs hyped as "HTML5 APIs..."

The APIs list

NOT part of HTML5!

HTML5 now

What to do?

Where to get more information?

www.CanIUse.com
html5test.com
html5readiness.com
developer.mozilla.org/en/
DiveIntoHTML5.info

Helpful tools

html5boilerplate.com
Modernizr.com

And one more thing...

Keep the web OPEN
and ACCESSIBLE to all.

Thanks! Questions?

For follow-ups: marcoos@marcoos.com, @marcoos.

Slides are online: j.mp/suwhtml5

Image credits: HTML5 logo by the W3C. Screenshots under fair use.

Slides engine: dzSlides, under WTFPL.

Syntax highlighting thanks to highlight.js by Ivan Sagalaev (license)