KEMBAR78
HTML5 Semantic Web | PPTX
HTML5 Semantic WebTerry Ryan |  Worldwide Developer Evangelist@tpryan
Who are you?2
Not Sexy and Adventurous3
It’s everyday stuff4
AgendaIntroductionOverview of SemanticsNew Semantic elements New Semantic attributes New Form Input TypesNew Form attributesPitfallsConclusions5
Overview6Semantics
Semantic HTML means your markup describes it’s content without Presenting it 7
What do we mean by Semantic HTMLHTML where proper elements are used<p> denotes paragraph<ul> denotes an list of items, where the order is not important <address> contains address information<div> and <span> are used to describe informationHTML where extraneous elements are not misusedNo <p> for line breakingNo <blockquote> for indentationNo <h1> for big textHTML without presentation informationNo <font>, <b>, <i> tagsNo inline styles8
Semantic HTML is a moving targetNot BooleanNot always objectiveA continuum9
Semantic HTML<body background="css/bg.png"><font face="Calibri”><center><table width="800" bgcolor="#FFFFFF" border="10" bordercolor="#FFFFFF"><tr><td><tablewidth="100%" bgcolor="#f0f0f0" border="0“><tr><td><h1><fontface="Palatino Linotype">The Awesome Blog ofAwesome</font></h1></td></tr><tr>    <td align="right"><p><i>Awesome is a State of Mind</i></p></td></tr></table>10<body><div id="header"><h1>The Awesome Blog of Awesome</h1><p class="tagline">Awesome is a State of Mind</p></div>Relatively UnsemanticRelatively Semantic
HTML5?11What does this have to do with HTML5?
HTML5 adds more semantics<body><header><h1>The Awesome Blog of Awesome</h1><p>Awesome is a State of Mind</p></header><nav><ul><li><ahref="">Home</a></li><li><ahref="">Blog</a></li><li><ahref="">About</a></li><li><ahref="">Contact</a></li></ul></nav>12
Introducing The Awesome Blog of Awesome13HTML5XHTML
Elements14
Header15
Header<div id="header"><h1>The Awesome Blog of Awesome</h1>	<p class="tagline">Awesome is a State of Mind</p></div>16<header><hgroup><h1>The Awesome Blog of Awesome</h1><h2>Awesome is a State of Mind</h2></hgroup></header>HTML 5Previously
Hgroup?17What’s the <hgroup> all about?
Hgroup18<hgroup><h1></h1>	<h2></h2></hgroup>It’s for grouping related headers, that don’t spawn their own node in the outline
Hgroup?19Huh?
Effect of hgroupH1 – Awesome Blog of Awesome
H2 - Awesome is a State of Mind
H2 - Recent Posts
H3 I Made a Post Thingie
H3 My Thoughts are made manifest 20H1 – Awesome Blog of Awesome
H2 Recent Posts
H3 I Made a Post Thingie
H3 My Thoughts are made manifest No HgroupWith HGroup
Hgroup?21Still huh?
OutlinesOutlines seem really important to the people who push semantic HTML 5Are they really important?Today: NoTomorrow: Who knows?But this is a semantically correct way of reducing classes and extraneous divs22
Footer23
Footer<div id="footer”><p>Copyright 2011 - Terry Ryan</p></div>24<footer><p>Copyright 2011 - Terry Ryan</p></footer>HTML 5Previously
Navigation25
Navigation<div id="nav">  <ul>    <li><a href="">Home</a></li>    <li><a href="">Blog</a></li>    <li><a href="">About</a></li>    <li><a href="">Contact</a></li>  </ul></div>26<nav><ul>    <li><a href="">Home</a></li>    <li><a href="">Blog</a></li>    <li><a href="">About</a></li>    <li><a href="">Contact</a></li>  </ul></nav>PreviouslyHTML 5
Articles27
Articles<divclass="post”><divclass="postheader"><h3><ahref="">I Scream My Thoughts</a></h3><pclass="date">August 10, 2011</p></div><p>You probably haven't heard of them duis</p></div>28<article> <header>  <h1><ahref="">I Scream My Thoughts</a></h1>  <time>August 10, 2011</time> </header> <p>You probably haven't heard of them duis</p></article>PreviouslyHTML5
An article is a piece of content that can stand on it’s own29
Date and Time<time datetime={datetime} pubdate>Human Readable String</time>DatetimeDate: 2011-09-20Datetime: 2011-09-20T20:00ZDatetime: 2011-09-20T20:00+00:00PubdateUsed with article to denote that this particular time is the publication date. 30
Date Time31Just the letter T2011-09-20T20:00ZZ for Zulu TimeHours:MinutesYear-Month-DayJust the letter T2011-09-20T20:00+00:00Year-Month-DayHours:MinutesTime Zone Offset
Section?32There’s also this thing called “<section>” how does that work.
An Article is a piece of stand-alone content33
Blog Post34
Or a comment35
A section is a collection of related pieces of content36
37
Articles can contain Sections38
Blog Post39ArticleSectionSectionSection
Sections can contain Articles40
Articles can contain other articles41
42ArticleSectionSectionSectionArticleArticle
Content43
Content<divclass=”content”> <divclass="post”> ... </div> <divclass="post”> ... </div> <divclass="post”> ... </div></div>44<divclass=”content”> <article> ... </article><article> ... </article><article> ... <article></div>PreviouslyHTML5
Also can be correct<divclass=”content”> <divclass="post”> ... </div> <divclass="post”> ... </div> <divclass="post”> ... </div></div>45<section class=”content”> <article> ... </article><article> ... </article><article> ... <article></section>PreviouslyHTML5
Umm46That’s great, but frankly not that much of a different, how is that better?
Benefit 1  </div> </div>    </div><div id=“footer”></div></body>47  </div> </article>    </div><footer></footer></body>Before these ElementsAfter
Benefit 2Less monkeying with content hierarchies48
49Post PageMain PageArchive Page<article> <header>  <h1><a href="">I Made a Post Thingie</a></h1>  <time datetime="2011-09-02">September 2, 2011</time> </header> <imgsrc="img/captain-awesome.jpg" width="300" height="200" alt="Image of Captain Awesome" /> <p>DIY eanulla photo booth temporoccaecat, velitnihilmixtapescenester.  Irony laboris echo park, wolf officia vice cupidatatlabore butcher freegan farm-to-table nisi velitaliqua gluten-free. Aliquipnesciuntassumenda,  wayfarers seitan wolf reprehenderitnulla twee sartorial dolore food truck voluptateex vinyl. Aliquip ex enim, irony terry richardson trust fund consecteturfappariatur dolor. Lo-fi nulla whatever mlkshk, banksyamerican apparel carlesadipisicingincididunt wolf photo booth hipster. Wayfarers four loko ex cosby sweater, adipisicingsartorial non cardigan craft beer cillumreprehenderit terry richardson 3 wolf moon mollit. Ethical utlabore beard, 3 wolf moon duis readymade assumenda hipster tofu mcsweeney's master cleanse.</p></article>article header h1ArticleArticleArticle
Benefit 3No longer bound to one header or one navcan have multiple. 50
New Elements work across Modern Browsers without Fail51
What’s you’re definition of Modern?52
Use the HTML 5 Shiv53http://code.google.com/p/html5shiv/
Attributes54
data55Add “data-” to anything to make your content contain data
Uses?
Scritping
Microformats
Perhaps future Search Engine hints.<p data-firstname=“Terry” data-lastname=“Ryan”>Terry Ryan</p>
These next things aren’t semantic, just kinda cool56
contenteditable57Allows any text to be user editable, not just input and textareas.
Uses
Better CMS systems
Comment previews<p contenteditable="true” class="comment">Comment</p>
spellcheck58Allows any field that is user editable to trigger the browser’s spellcheck interface
Uses:
No one spellchecks anything they post on the web
But you will have the moral high ground to point out on your site they could have. <p contenteditable="true" spellcheck="spellcheck" class="comment">Comment</p>
Form59Input
HTML5 includes lots of new Input types60
They aren’t supported on every browser61
All browsers default to showing unknown input types as Text62
Search63Support is spotty
Browser vendors tend to round, add magnifying glass, etc. <input type=“search” name=“search” />
Email64Provides validation
Provides email keyboard on iOS devices.<input type=“email” name=“email” />
Url65Provides validation
Provides url keyboard on iOS devices.<input type=“url” name=“url” />
Number66Provides keypad on iOS and Android devices.
Provides a stepper on desktops
Takes attributes:
Min/Max
Step<input type=“number” name=“cost” />
Tel67Provides keypad on iOS and Android devices.<input type=“tel” name=“cell” />
Not well supported, but have potential68
Range69Provides a set of values
The slider allows you to pick one
Not terribly precise
Takes attributes:
Min/Max
Step<input type=“range” name=“volume” />
Date70Provides validation
On Opera
Displays a data picker
On Safari/Chrome
Displays ticker

HTML5 Semantic Web