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

Post on 06-May-2015

2.533 views 1 download

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

HTML5 EssentialsShaymaa Al-TerkaitMicrosoft | shaymaa@microsoft.com | @ahamshay

A very brief history of

Web Standards.

Content

CSS 2.1XHTML1Presentation

2001 - 2006

Content

CSS 3HTML5Presentation

2007 - Present

HTML5The Content Layer

New Elements

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

Figure

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

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>

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.

New Form Controls

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.

DOC Structure

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>

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">

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

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

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

<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.

CSS3The Presentation Layer

Color

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; }

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); }

Background

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; }

Borders

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;

MoreBorder-imageBorder-radiusBox-shadow

Text

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;

@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; }

Transformation

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);

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);

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.

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, shaymaa@microsoft.com @ahamshay

© 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.