HTML5: The Future of Web Development with IE9, IE10 and Windows 8

38

description

HTML5 is with us now and Windows 8 will be putting HTML 5 front and centre, literally. IE9 and 10 allow you to make use of a lot of the best bits from HTML5 and CSS 3 today. This session will take you through some of the new Web API's and techniques made available as part of IE9/10's support for HTML5.

Transcript of HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Page 1: HTML5: The Future of Web Development with IE9, IE10 and Windows 8
Page 2: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

HTML5 EssentialsShaymaa Al-TerkaitMicrosoft | [email protected] | @ahamshay

Page 3: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

A very brief history of

Web Standards.

Page 4: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Content

CSS 2.1XHTML1Presentation

2001 - 2006

Page 5: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Content

CSS 3HTML5Presentation

2007 - Present

Page 6: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

HTML5The Content Layer

Page 7: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

New Elements

Page 8: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Structural ElementsProvides new semantic vocabularyfor parts of a page previouslyserved by DIVs with ID and Classattributes.

Page 9: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Figure

Allows for associating captionswith embedded content, includingvideos, audio, pullquotes, orimages.

Page 10: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Audio & Video

Allows for associating captionswith embedded content, includingvideos, audio, or images.

<video src="test.ogg" autoplay="autoplay"controls="controls">Your browser does not support the videoelement. This could also include object andembed codes for legacy browsers.</video>

Page 11: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Other ElementsMETER Contained content is a measurement, like length.PROGRESS Contains current process toward a goal, like a percentage.TIME Time.COMMAND Represents something a command a user may execute.DATAGRID Represents data. Non-tabular or otherwise.OUTPUT Displays the output of a program or process.RUBY Allows input of rubi/ruby annotations for Asian languages.

Page 12: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

New Form Controls

Page 13: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Form ControlsDATETIME Allows input of a date and a time.DATETIME-LOCAL Allows input of a date and a time, in local time.NUMBER Allows input of a number.RANGE Input is verified to be within a range.EMAIL Confirms the input to be a valid email.URL Ensures input is a valid URL.COLOR Provides a mechanism for the user to input an RGB color.

Page 14: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

DOC Structure

Page 15: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

HTML5 doctype

The HTML 5 doctype is wayeasier than any other doctype.Ever!

Just type the parts you remember,and you’ll probably be right.

<!DOCTYPE html>

Page 16: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

HTML5 & XHTML5HTML 5 supports the standardHTML syntax (formerly SGML),but also allows for an XML-basedvariant XHTML5.

Since it’s XML, XHTML shouldbe served as application/xml orapplication/xhtml+xml. Warning:this means browsers freak if there’san error.

<html>vs.

<html xmlns="http://www.w3.org/1999/xhtml">

Page 17: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Allows objects (images and links,by default) to be dragged and thendropped onto a target.The target is enabled by cancelingthe ‘dragover’ (for sane browsers)or ‘dragenter’ (for IE) events forthe drop target. Then listen for a‘drop’ event which contains a‘dataTransfer’ object with info.

Drag & Drop API

Page 18: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

The sessionStorage DOM attributestores session data for a singlewindow, like cookies on crack.

The localStorage DOM attributeallows each site to store megabytes of data across sessions to improve performance.

Both methods store only strings.

<inputtype="checkbox"onchange="localStorage.insurance=checked"/>

Simple Client Storage

Page 19: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Allow the client to refer directly toits cache, authoritatively, forcertain resources, even if thebrowser is offline.

Resources listed in the “network”section are never cached.

<html manifest=”/cache.manifest”>

CACHE MANIFESTindex.htmlhelp.htmlstyle/default.cssimages/logo.pngimages/backgound.png

NETWORK:server.cgi

Offline Application Caching

Page 20: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

<canvas id="canvas" width="150" height="150">

fallback content</canvas>

function draw() {var canvas =

document.getElementById("canvas");

if (canvas.getContext) {var ctx =

canvas.getContext("2d");ctx.fillStyle =

"rgb(200,0,0)";ctx.fillRect (10, 10, 55, 50);ctx.fillStyle = "rgba(0, 0,

200, 0.5)";Ctx.fillRect (30, 30, 55, 50);}

}

CanvasProvides an API for drawingdirectly in the browser window,using instructions that definevector-based shapes and lines.

This allows SVG-like graphics to be created on the fly in the browser, with fallback content (like Flash?) provided to legacy browsers.

Page 21: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

CSS3The Presentation Layer

Page 22: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Color

Page 23: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Opacity

Adjusts the opacity of the selectedelement’s presentation on screen.

Takes values between 0.0 (fullytransparent) and 1.0 (fullyopaque)

div { color: #f00; opacity: 1.0; }

div { color: #f00; opacity: 0.5; }

Page 24: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

RGBA ColorLike RGB color definitions, butallows a fourth field, defining thealpha value of the color beingapplied.Like opacity, the alpha value isbetween 0.0 (fully transparent)and 1.0 (fully opaque).

div { color: rgb(0,255,0); }

div { color: rgba(0,255,0,0.5); }

Page 25: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Background

Page 26: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

background-sizeDefines the size at which thebrowser should display the specified background image. Accepts all normal size definitions as width followed by height.

In shorthand, this appears afterbackground-position values.

div { background-size: 100px 65px; }

div { background-size: 400px 65px; }

Page 27: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Borders

Page 28: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Border-colorAllows for multiple border colorsto be specified, one pixel at a time. The last specified color is repeated if necessary.

This cannot be used in the bordershorthand syntax.

border: 5px solid #000;border-color: #000 transparent transparent #000;

Page 29: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

MoreBorder-imageBorder-radiusBox-shadow

Page 30: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Text

Page 31: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Text-shadowCreates a drop shadow beneath the selected text.

The first argument is the horizontal offset, the second is the vertical offset, the third is the blur radius, and the final argument is the color to be used as the shadow. Multiple shadow definitions may be separated using commas.

text-shadow: 10px 10px 10px #333;

Page 32: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

@font-faceAllows a font file to be associatedwith a font name for later use infont-family declarations.

IE supports only .eot EmbeddedOpenType files, while the otherbrowsers support any TTF andOTF font files.

@font-face { font-family: Helvy; src: local("Helvetica Neue Bold"),

local("HelveticaNeue-Bold"),url(MgOpenModernaBold.ttf);

font-weight: bold;}p.specialFont { font-family: Helvy, sans-serif; }

Page 33: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

Transformation

Page 34: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

rotateRotates the selected element at the defined angle, defined in degrees.

The rotation doesn’t affect layout,and elements that are transformed are treated similarly to position:relative.

transform: rotate(30deg);

Page 35: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

scaleScales the element in questionbased on the specified unit-lessnumbers given for the X and Yaxes. If only one number is given, it is applied to both axes.

transform: scale(0.5,2.0);

Page 36: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

3D TransformationPERSPECTIVE The distance, in pixels, of the z=0 plane from the viewer.MATRIX3D Allows creation of a 3d transformation matrix.ROTATE3D Rotate the matched element in three dimensions.SCALE3D Performs a three-dimensional scale operationTRANSLATE3D Allows the matched element to be moved along three axes.

Page 37: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

ResourcesHTML 5 Doctor http://html5doctor.com/ HTML 5 Spec http://dev.w3.org/html5/spec/Overview.htmlALA Article http://www.alistapart.com/articles/previewofhtml5IE9 Experience http://beautyoftheweb.com/

Your PresenterShaymaa Al-Terkait, [email protected] @ahamshay

Page 38: HTML5: The Future of Web Development with IE9, IE10 and Windows 8

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.