4. A Doctype you can
remember in
your head
Before:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/
xhtml1/DTD/xhtml1-transitional.dtd">
After
<!DOCTYPE html>
5. Cleaner meta
Before
<meta http-equiv=”content-type”
content=”text/html” charset=”uft-8”>
after
<meta charset=”utf-8”> (works now)
10. HTML5 transition:
HTML compatibility
<script type=”text/javascript”> => It’s javascript folks,
no need to specify a type
<style type=”text/css”> => Is there any other type?
<a href=”#”><img border=”0”></a> => border is
staying for the moment, only with a value of 0
13. The minimal requirements for
a consistent DOM with XHTML
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8”>
<title>My Page</title>
</head>
<body>
<p>any other content</p>
</body>
</html>
14. The minimal requirements for
a consistent DOM with XHTML
<table>
<tbody>
<tr>
<td>....</td>
</tr>
</tbody>
</table>
16. HTML5 transition:
Semantic changes
<em> => You can nest to extra emphasis
<small> => small print, disclaimer, caveats, less
important
<i> => Alternate voice/mood. Idioms, tech term
<br> => line break in poems, addresses
<hr> => thematic break
17. HTML5 transition:
More Semantic changes
<strong> => Importance rather than emphasis
<b> => stylistically offset text. (keyword, leading
paragraph)
<address> =>is for contact details of the author of
the current article or document not just for postal
address.
18. HTML5 transition:
un-deprecated
<iframe> => nested html
<embed> => for plugins (Works today)
target attribute (<base target> <a target> <area
target>)
<li value>
<ol start>
<ol><ul> can now have 0 items
<ol reversed>
19. HTML5 transition:
cite
html4 allowed use of cite speaker names
html5 only allows title of a work, disallows people
workaround <cite> + hCard for speakers
<blockquote cite=”#ds”>
And then I said: let there be light
</blockquote>
<cite class=”vcard”>
<span class=”fn” id=”ds”>
Diego Scataglini
</span>
</cite>
20. Microsoft WIN
contenteditable*
contenteditable is now officially part of HTML
The DOM attribute is contentEditable
el.contentEditable = [value]
to check
el.isContentEditable
document.designMode = ‘on’ makes the entire
document editable, only by javascript.
*contenteditable works today across browsers
21. Self explanatory tags
data-* => To pass information to scripts from markup
draggable => no need to explain
hidden => no need to explain
role, aria-* attributes => see WAI-ARIA
spellcheck => boolean to tell the browser to use it or
not
tabindex => now it can have a -1 to skip the element
22. unsupported tags
<menu>, <command contextmenu> to define
toolbars and context menus for your application
microdata is a method of marking up elements with
additional machine-readable data.
item, itemprop => key value store passing for
microdata
<style scoped> Scoped tells the browser to apply the
styles only to the wrapping elements and its
children.
26. Now we can use these
<div (id|class)=”header”> => <header>
<div (id|class) =”nav”> => <nav>
<div (id|class) =”sidebar”> => <aside>
<div (id|class) =”article”> => <article>
<div (id|class) =”footer”> => <footer>
What about “content”?
Whatever is not one of: header, nav, footer, aside
is usually the content or you can use WAI-ARIA
and add role=”main” to the wrapping element
27. CSS Gotch’yer block?
These new elements are all display: inline so if
you want to have them as blocks you need to do
so yerself
header, nav, footer, article {display: block; }
nav {float:left; width: 20%; }
article {float:right; width: 79%; }
footer {clear: both;}
28. IE Gotch’yer CSS?
IE will ignore that css goodness and won’t let you
style any of those new tags unless you create them
through javascript like so in the HEAD provided
those elements are inside a body tag:
<script>
document. createElement(‘ header’ );
document. createElement(‘ nav’ ) ;
document. createElement(‘ article’ ) ;
document. createElement(‘ footer’ );
</script>
29. <Article> for content
(can have many)
Headers can be used also to specify heading of sections
or articles
<article>
<div class=”article-header”>
<h2>My awesome post</h2>
</div>
<p>Yeah right</p>
<div class=”article-meta”>
Posted in awesomeness
</meta>
</article>
30. <Header> not just for
Headers?!?
Headers can be used also to specify heading of sections or articles
or anything else. You can have as many headers as you need
<article>
<header>
<h2>My awesome post</h2>
</header>
<p>Yeah right</p>
<div class=”meta”>
Posted in awesomeness
</meta>
</article>
31. Like-wise for <footer>
Headers can be used also to specify heading of sections
or articles
<article>
<header>
<h2>My awesome post</h2>
</header>
<p>Yeah right</p>
<footer>
Posted in awesomeness
</footer>
</article>
32. Time
If you’re happy with the machine readable* inside the
tags you can omit the datetime attribute:
<time>20:00</time>
*The spec says “The time element represents either a
time on a 24-hour clock, or a precise date in the
proleptic Gregorian calendar, optionally with a time
and a time-zone of set.”
33. <Time> [datetime]
Valid formats: YYYY-MM-DD, HH:MM, or full with date
and time and timezone
<article>
....
<footer>
Posted in awesomeness
on <time
datetime=”2010-11-13T12:00:00.001-04:00”>1
millisecond past midnight</time>
</footer>
</article>
34. <Time> [pubdate]
pubdate is a boolean attribute that indicates the
publication date of an <article> or the whole <body>
content
<article>
<footer>
Posted in awesomeness
on <time
datetime=”2010-11-13T12:00:00.001-04:00”
pubdate>1 millisecond past midnight</time>
</footer>
</article>
35. <HGROUP>
<header>
<a href=”/”><img src=logo.png /></a>
<hgroup>
<h1> My awesome blog </h1>
<h2> Yeah, that’s right, I went there</h2>
</hgroup>
</header>
36. Articles for
comments?
Article can be nested inside of articles and it’s
actually encouraged by the specs “When article
elements are nested, the inner article elements
represent articles that are in principle related to
the contents of the outer article. For instance, a
blog entry on a site that accepts user-submitted
comments could represent the comments as article
elements nested within the article element for the
blog entry.”
40. footer <NAV>?
The specs suggests that the “legal” links
and usually footer links not be wrapped
in <nav> but it’s debatable and debated
41. <ASIDE>
A section of a page that consists of content that is
tangentially related to the content around the aside
element, and which could be considered separate from
that content. Such sections are often represented as
sidebars in printed typography.
The element can be used for typographical effects like
pull quotes or sidebars, for advertising, for groups of
nav elements, and for other content that is considered
separate from the main content of the page.
42. <DETAILS>
a disclosure widget from which the user can obtain
additional information or controls. (not implemented
yet)
Provides a expanding/collapsing area.
The first child should be a <summary> element
followed by flow elements.
<details open> to make it default to the open state
43. <FIGURE>
The figure element represents some flow content,
optionally with a caption, that is self-contained and is
typically referenced as a single unit from the main flow of
the document.
<figure>
<img src...>
<figcaption>
Diego’s awesome God-like Body
</figcaption>
</figure>
44. <MARK>
The html equivalent of a highlighter.
represents a run of text in one document marked or highlighted for
reference purposes, due to its relevance in another context. When
used in a quotation or other block of text referred to from the prose, it
indicates a highlight that was not originally present but which has
been added to bring the reader's attention to a part of the text that
might not have been considered important by the original author
when the block was originally written, but which is now under
previously unexpected scrutiny.When used in the main prose of a
document, it indicates a part of the document that has been
highlighted due to its likely relevance to the user's current activity.
45. <RUBY> our favorite
tag
The ruby element allows one or more spans of phrasing content to be marked
with ruby annotations. Ruby annotations are short runs of text presented
alongside base text, primarily used in East Asian typography as a guide for
pronunciation or to include other annotations. In Japanese, this form of
typography is also known as furigana.
A ruby element represents the spans of phrasing content it contains, ignoring
all the child rt and rp elements and their descendants. Those spans of
phrasing content have associated annotations created using the rt element.
46. <RUBY> best practices
<ruby>
<rp>(</rp><rt> </rt><rp>)</rp>
<rp>(</rp><rt> </rt><rp>)</rp>
</ruby>
Non compliant browsers will render ( ) ( )
NOTE: IE has had these for a very long time.
52. Heading values don’t
mean $#!t
<h6>Hello</h6>
<article> 1. Hello
<h1>world</h1> 1. world
</article>
53. Not having a headline
Still counts
<h6>Hello</h6>
<article> 1. Hello
<p>world</p> 1. Untitled
</article> Section
54. Sometimes legitimate
For <nav> and <aside> is perfectly legitimate
to not have a heading.
It’ll still come up as “untitled section” though
Check your outline @
http://gsnedders.html5.org/outliner/
55. Hgroup are Highlanders
“there can be only one”
<h6>Hello</h6>
<article>
<hgroup>
<h6>Cruel</h6> 1. Hello
<h1>World</h1> 1. World
</hgroup> Highest heading
</article>
value wins
56. Sectioning Roots
<blockquote> <fieldset> Can have their own
<body> <figure> outline but don’t
<details> <td> contribute to ancestors’
outlines
63. Attribute goodness
autocomplete*, min, max, step, multiple, required,
pattern, list, autofocus, placeholder
Step can also take “any” (any accuracy)
Most of them do what you expect them to.
list is a separate interesting beast by itself
*works today
64. list & <DATALIST>
<datalist> is like an editable <select>. It let users type
their own value if none of available choices pleases
them. Referenced by ID in the list attribute.
<input name=phone-type type=text list=location />
<datalist id=”location”>
<option label=”home” value=”h”>
<option label=”work” value=”w”>
<option label=”mobile” value=”m” >
</datalist>
67. <VIDEO> attributes
controls => tells the browser to provide controls
poster => URL to an image to show while
downloading
height, width, autoplay, preload => exactly as expected
68. seize the <VIDEO>
<video> will always respect the aspect ratio of the
resource even if you specify it wrong. It’ll be rendered
“letter-boxed”.
In absence of width attribute, the width will be
calculated from the poster frame size. If the poster
attribute is missing it’ll fall back on the video resource,
otherwise it’s 300px.
70. different <VIDEO>
for different strokes
<video controls>
<source src=”my-super-hi-res-video.mp4”
media=”(min-device-width:1280px)”>
<source src=shitty-low-res.mp4>
</video>
72. No DRM, for DRM restriction use plugins
No standard codec so provide them all
<video controls>
<source src=video.ogv
type=’video/ogg codecs=”theora, vorbis”’>
<source src=video.mp4
type=’video/mp4 codecs=”avc1.42E01E, mp4a.40.2”’>
<!-- fallback -->
<p>Please download the video in <a
href=”video.ogv”>Ogg</a> or <a href=”video.mp4”>
format.</p>
</video>
74. Customizing
<VIDEO>
<video controls id=”cool” src=cool.ogv></video>
...
var video = document. getElementsByTagName(‘ video’ )[0] ;
video.removeAttribute(‘ controls’ ) ;
/* now you have access to
video.paused, video.ended, video.currentTime, video.play(),
video.pause() and more */
95. What about IE9?
IE9 will bring good support for canvas, at par
with everybody else
Media support will be pretty good, work needs
to be done.
Nothing yet on the form elements, new tags
and attributes.
96. Thanks
Diego Scataglini
http://www.diegoscataglini.com