#html5css3 HTML5 and CSS3: Ready for Prime Time? Christopher Schmitt ChristopherSchmitt.com http://twitter.com/@teleject 1
Christopher Schmitt ChristopherSchmitt.com http://twitter.com/@teleject 2
http://e4h.tv Christopher Schmitt ChristopherSchmitt.com http://twitter.com/@teleject 3
DESIGN 4
5
6
7
8
9
10
11
12
DESIGNING ONLINE 13
14
15
http://youtu.be/RPcqz3pXQ-w?t=7m42s 16
17
18
19
20
21
22
XHTML Everyone THINGS ARE GOOD else BETWEEN US, XHTML, RIGHT? I MEAN. WE GET ALONG WELL. AND WE BOTH LIKE STUFF. 3 23 23
http://dev.opera.com/articles/view/mama-markup-validation-report/ 24 24
“THE ATTEMPT TO GET THE WORLD TO SWITCH TO XML, INCLUDING QUOTES AROUND ATTRIBUTE VALUES AND SLASHES IN EMPTY TAGS AND NAMESPACES ALL AT ONCE DIDN’T WORK.” SIR TIM BERNERS-LEE 25 25
http://www.flickr.com/photos/teleject/432030263/ 26 26
27 27
28 28
29 29
WEB 2.0 30 30
31 31
BLUEPRINTS VS REALITY http://www.amazon.com/gp/product/0140139966 32 32
“TAKE CARE OF THE LUXURIES AND THE NECESSITIES WILL TAKE CARE OF THEMSELVES.” FRANK LLOYD WRIGHT 33 33
BUILDING WITH HTML5 34 34
PAGE STRUCTURE 35 35
DIV ID=“header” DIV ID=“nav” DIV ID=“section” DIV ID=“sidecolumn” DIV ID=“article” DIV ID=“footer” 36 36
<HEADER> <NAV> <SECTION> <ASIDE> <ARTICLE> <FOOTER> 37 37
ARTICLE VS ASIDE VS SECTION • Molly Holzschlag, Opera standards evangelist, says: • <section> clarifies <div> • <article> 'replaces' <div id="content"> • <aside> 'replaces' <div id="sidebar"> • Chris Mills, Opera browser employee, plays it safe: http://boblet.tumblr.com/post/130610820/html5-structure1 38 38
WHAT ABOUT THE DIVS? • Marc Grabanski, jQuery and HTML5 guy: • “div has no meaning whatsoever, so there is nothing semantic about divs” • Bruce Lawson, Opera browser employee: • “Likeall semantic questions, it depends on the context. If your only reason for wanting an element is to group stuff for styling, it's a div.” 39 39
<body> <header> <h1>Heading </h1> </header> <nav> <h3>Site Navigation</h3> <ul>...</ul> </nav> <section> <article> <h3>Weblog Entry</h3> </article> </section> <aside> <p>You are reading "Chocolate Rain", an entry posted on <time datetime="2009-03-05">5 March, 2009</time>, to the <a href="#">Misty collection</a>. See other posts in <a href="#">this collection</a>.</p> </aside> <footer> <p>...</p> </footer> </body> 40 40
41 41
42 42
<script type="text/javascript"> document.createElement('header'); document.createElement('nav'); document.createElement('section'); document.createElement('article'); document.createElement('aside'); document.createElement('footer'); </script> http://ejohn.org/blog/html5-shiv/ 43 43
44 44
HTML5 VIDEO 45 45
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Basic HTML5 Web Document Structure</title> </head> <body> <h1>Video Example</h1> <object width="425" height="344"><param name="movie" value="http:// www.youtube.com/v/4GuKSqAg5xI&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http:// www.youtube.com/v/4GuKSqAg5xI&hl=en&fs=1" type="application/x- shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object> </body> </html> 46 46
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Basic HTML5 Web Document Structure</title> </head> <body> <h1>Video Example</h1> <video src="html5test.ogg" width="320" height="240" controls poster="html5testvideoposter.jpg"> <a href="html5testvideo.ogg">Download movie</a> </video> </body> </html> 47 47
HTML5 VIDEO • WIDTH and HEIGHT should be required, IMO, but movie plays anyway based on the values in the video file itself. • Video formats may have their own posterframe. The browser should use that by default unless overridden by valid POSTER attribute value. • Text can be included within VIDEO element to allow user to download video if their browser doesn’t support. • If you want to give users control, use CONTROL attribute. 48 48
HTML5 VIDEO • Video can start automatically if using the AUTOPLAY=”1” attribute and value. • Spec provides for LOOP, AUTOBUFFER which also take a value of O or 1. • Codecs support... 49 49
HTML5 VIDEO “It would be helpful for interoperability if all browsers could support the same codecs. However, there are no known codecs that satisfy all the current players: we need a codec that is known to not require per-unit or per-distributor licensing, that is compatible with the open source development model, that is of sufficient quality as to be usable, and that is not an additional submarine patent risk for large companies. This is an ongoing issue and this section will be updated once more information is available.” - http://www.whatwg.org/specs/web-apps/current-work/#video- and-audio-codecs-for-video-elements 50 50
CODECS • Ogg (or “Vorbis”) • No need to worry about patents • H.264 • Created by the MPEG group • If you have blu-ray disc player, you are using it • WebM •A wrapper for the VP8 video and Ogg audio streams 51 51
VIDEO CODEC SUPPORT FF3.6+ S Ch5+ Op10.6+ IE9 Ogg Y Y Y H.264 Y Y* Y WebM (W4.02+) (Ch6+) Y 52 52
http://firefogg.org/ 53 53
http://www.videolan.org/vlc/ 54 54
http://handbrake.fr/ 55 55
LESSONS LEARNED • Use VLC or Firefogg to encode common movie files types to OGG • H.264 encoding? Use Handbrake • Ifyou are hot to trot for HTML5 Video, like, right now, check out Mark Pilgrim’s tutorial: http://diveintohtml5.org/video.html • Good primer: http://dev.opera.com/articles/view/introduction-html5-video/ 56 56
57 57
58 58
<script> function playPause() { var myVideo = document.getElementsByTagName('video')[0]; if (myVideo.paused) myVideo.play(); else myVideo.pause(); } </script> 59 59
<input type=button onclick="playPause()" value="Play/Pause" tabindex="0" /> 60 60
HTML5 VIDEO & CAPTIONS 61 61
[Captioning] has been shown to improve reading skills among adults who are non- readers. http://www.ldonline.org/article/35793 62 62
63 63
QUICK & DIRTY CAPTIONING 64 64
http://github.com/johnmcc/jCaps 65 65
66 66
67 67
SRT FILES • SRTfiles are text files used in video playback; therefore, they do not contain any video data. • Text file containing subtitles used by various video playback programs; supported by DivX, DVD, and other video formats; • Includes the time each subtitle should be displayed followed by the text of the subtitles. • Subtitle files are often named according to the language of the subtitles, i.e. "moviename-eng.srt" for English and "moviename- ger.srt" for German subtitles. 68 68
TRANSCRIPT-EN.SRT 1 00:00:00,000 --> 00:00:6,000 Allow me to introduce myself My name is Tay It's T-A-Y, T-A-Y to the Z 2 00:00:06,000 --> 00:00:9,000 This is the web and it's gonna murder your TV It was Chocolate Rain 3 00:00:09,500 --> 00:00:11,500 Wrote a song about that history Chocolate Rain 4 00:00:12,000 --> 00:00:15,000 Now I'm paid a hefty hefty fee Chocolate Rain 69 69
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"> </script> <script src="jquery.jcap.js"></script> 70 70
 <video id="myVid" width="400" src="cherry-chocolate- rain.ogv" autobuffer controls>   <track src="transcript-en.srt" type="text/srt" language="en" role="textaudesc"></track>   <track src="transcript-gr.srt" type="text/srt" language="gr" role="textaudesc"></track>   <p>Alternative text...</p> </video> 71 71
 <video id="myVid" width="400" src="cherry-chocolate-rain.ogv" autobuffer controls>   <track src="transcript-en.srt" type="text/srt" language="en" role="textaudesc"></track>   <track src="transcript-gr.srt" type="text/srt" language="gr" role="textaudesc"></track>   <p>Alternative text...</p> </video> 72 72
BUILDING WITH CSS3 73 73
~50 CSS3 Modules http://www.w3.org/Style/CSS/current-work#CSS3 74 74
WHERE IS CSS3 COMING? • The specification is divided into different chunks, modules • http://www.w3.org/Style/CSS/current-work • Transformations • Animations • Media Queries • and so on, and so on... • at a glacial pace ever towards yesterday 75 75
WHERE IS CSS3 COMING? • The specification is divided into different chunks, modules • http://www.w3.org/Style/CSS/current-work • The specification is being written by W3C • http://www.w3.org/Style/CSS/ 76 76
WHERE IS CSS3 COMING? • The specification is divided into different chunks, modules • http://www.w3.org/Style/CSS/current-work • The specification is being written by W3C • http://www.w3.org/Style/CSS/ • Browservendors (like Firefox, Safari, and Opera) are implementing their own versions of these unfinished standards • IE9 is “bringing the power of PC hardware and Windows” 77 77
78 78
IMAGE MASKS 79 79
80 80
81 81
82 82
83 83
84 84
TEXT COLUMNS 85 85
86 86
TEXT COLUMNS <div id="column"> <p>…<p> <h2>…</h2> <p>…<p> <h2>…</h2> <p>…<p> </div> 87 87
TEXT COLUMNS #column { -moz-column-gap: 3em; -moz-column-width: 11em; -webkit-column-gap: 3em; -webkit-column-width: 11em; padding: 10px; } 88 88
TEXT COLUMNS #column { -moz-column-gap: 3em; -moz-column-width: 11em; -moz-column-rule: 1px solid #ccc; -webkit-column-gap: 3em; -webkit-column-width: 11em; -webkit-column-rule: 1px solid #ccc; padding: 10px; } 89 89
LESSONS LEARNED • Proprietary CSS extensions in Firefox and Safari. • JavaScriptsolution through a jQuery plugin: http://welcome.totheinter.net/2008/07/22/multi-column-layout-with- css-and-jquery/ 90 90
COMPLEX ANIMATING LINKS 91 91
92 92
COMPLEX ANIMATED LINKS • Web designer Faruk Ateş’s personal site (see http://farukat.es/) uses the transition property to change the color of the element. • As well as the color, width, box shadow, text shadow, and opacity. 93 93
COMPLEX ANIMATED LINKS #web20 li a { text-shadow: rgba(0,0,0, 0) 1px 1px 2px; -moz-box-shadow: rgba(0,0,0, 0) 2px 2px 2px; -webkit-box-shadow: rgba(0,0,0, 0) 2px 2px 2px; -moz-border-radius-topright: 31px; -moz-border-radius-bottomright: 31px; -webkit-border-top-right-radius: 31px; -webkit-border-bottom-right-radius: 31px; -webkit-transition: background-color .25s ease, color .5s ease, width .2s ease-out, -webkit-box-shadow .25s ease, text-shadow .2s ease, opacity .2s ease; } 94 94
BUILDING WITH SANITY 95 95
96 96
97 97
98 98
http://incident57.com/codekit/ 99 99
100 100
101 101
102 102
103 103
104 104
105 105
WHERE IS HTML & CSS GOING 106
http://www.alwaysbetonjs.com 107 107
108
109
110
111
112
113
http://www.sencha.com/blog/the-making-of-fastbook-an-html5-love-story/ 114
115
116
117
118
http://alistapart.com/article/testing-websites-in-game-console-browsers 119
http://mediaqueri.es/ 120
// default, mobile-1st CSS rules devices go here @media screen and (min-width: 480px) { ... } @media screen and (min-width: 600px) { ... } @media screen and (min-width: 768px) { ... } @media screen and (min-width: 910px) { ... } 121
122
123
124
125
126
127
128
129
130
131
132
THANK YOU! Christopher Schmitt schmitt@heatvision.com http://twitter.com/teleject 133 133

[amigos] HTML5 and CSS3