a brief introduction on html5 and responsive layouts

28

Upload: tim-wray

Post on 01-Nov-2014

382 views

Category:

Technology


1 download

DESCRIPTION

This presentation outlines some of the features that have been introduced with HTML5, along with a very simple example on how to implement a responsive layout using CSS3 media queries.

TRANSCRIPT

Page 1: A brief introduction on HTML5 and responsive layouts
Page 3: A brief introduction on HTML5 and responsive layouts

HTML5

• The latest version of HTML today for the Modern Web.

• First published by WHATWG (Web Hypertext Application Technology Working Group) in 2007.

Page 4: A brief introduction on HTML5 and responsive layouts

a living standard• HTML5 is considered to be a living

standard.

• This is because WHATWG is a community driven body, and the process of defining that standard is open.

• Some features, such as the <canvas> tag, were introduced by vendors, than adopted as part of the standard.

Page 5: A brief introduction on HTML5 and responsive layouts

So what are the new features of HTML5?

Page 6: A brief introduction on HTML5 and responsive layouts

the semantic layoutcustom data attributesnew UI tagsintelligent form inputsCSS3canvas graphicsaudio and videodrag and drop eventsoffline storagegeolocation

Page 7: A brief introduction on HTML5 and responsive layouts

the semantic layout• A new group of HTML tags allows you

to build your Web page using a semantic layout.

• This means that logically grouped sections have equally logical tags.

• e.g. Headers and footers are wrapped in <header> and <footer> tags. Sections and contents can be enclosed in <section> and <article> tags.

Page 8: A brief introduction on HTML5 and responsive layouts

custom data attributes

• Custom data attributes allow you to store custom, arbitrary data inside your HTML elements.

• This is incredibly useful if you need data to be stored statefully within your elements.

Page 9: A brief introduction on HTML5 and responsive layouts

<img data-flickr-photo-id="7953435190" alt="Tacoma Hipsters" src="http://farm4.staticflickr.com/3173/2768042395_5208451c4e_o.jpg" />

• alt : Alternate, placeholder text of the image.

• src : The URL of the image.

• data-flickr-photo-id : The data attribute of the element, indicating the Flickr ID of the image.

Page 10: A brief introduction on HTML5 and responsive layouts

new UI tags• HTML5 also introduces a few new user

interface (UI) tags.

• e.g., the <mark> tag for highlighting text, <figure> and <figcaption> for providing new details to images, <meter> and <progress> to display static meters and progress bars.

Page 11: A brief introduction on HTML5 and responsive layouts

smarter forms• Form inputs allow your users to

‘submit’ data to your site and post it back to the server.

• HTML5 allows much more intelligent form fields that restrict date entry to specific input formats.

• For example, you can enforce numbers, number ranges, dates, e-mail addresses and URLs within form fields.

Page 12: A brief introduction on HTML5 and responsive layouts

CSS3

• New styles such as gradients, box shadows etc. without the use of images.

• Also a much more powerful way of selecting individual attributes.

• You can also create transformations, transitions and animations.

Page 13: A brief introduction on HTML5 and responsive layouts

canvas graphics

• The <canvas> element, and the Canvas API, can be used to dynamically create graphics within the browser.

• Originally designed to compete directly with Adobe Flash.

• HTML5 also has an experimental specification called WebGL, that allows for 3D graphics within the Web browser.

Page 14: A brief introduction on HTML5 and responsive layouts

audio and video support

• Via the use of the <audio> and <video> tags, allowing for media playback within the browser without the use of Flash.

Page 15: A brief introduction on HTML5 and responsive layouts

drag and drop events• The ability to respond to drag and drop

events in JavaScript allows for the creation of desktop-like experiences : “Web Apps” within the browser.

• e.g. In Vimeo, you can upload videos by dragging files into the browser from your desktop

Page 16: A brief introduction on HTML5 and responsive layouts
Page 17: A brief introduction on HTML5 and responsive layouts

offline storage• For many years, cookies have been

used as a way to store information within a user’s Web Browser.

• The Web Storage API is the HTML5 version of this, being simpler and more powerful.

• WebSQL and IndexedDB allow for database-style storage within the browser.

Page 18: A brief introduction on HTML5 and responsive layouts

offline detection / synchronisation

• HTML5 allows for your website / Web App to work offline.

• It does this by creating an offline copy of your site and syncing it with the online copy there’s an Internet connection.

• Creates the illusion that your Web App is always available.

Page 19: A brief introduction on HTML5 and responsive layouts

geolocation

• You can use the browser’s geolocation API to provide information and guidance about a user’s physical location.

• These can be tied into other services, such as Google Maps, to provide location-based Web content to you.

Page 20: A brief introduction on HTML5 and responsive layouts

photos near youusing geo-location, and the Flickr and Google Maps APIs

Page 21: A brief introduction on HTML5 and responsive layouts

web workers• A way of providing multithreading

support in JavaScript.

• For example, a CPU intensive Web Worker (such as one that applies graphics filters and effects to images) can be spawned, allowing the main thread that controls the UI to be free and responsive.

Page 22: A brief introduction on HTML5 and responsive layouts

“HTML5 or native app?”an examination of semantic elements

Page 23: A brief introduction on HTML5 and responsive layouts
Page 24: A brief introduction on HTML5 and responsive layouts
Page 25: A brief introduction on HTML5 and responsive layouts

responsive web design

Responsive Web Design, uses liquid layouts and CSS3 media queries to adapt the layout to the

viewing environment.

Page 26: A brief introduction on HTML5 and responsive layouts

This stylesheet gets ‘activated’ when the screen size is below a certain width<head> <meta charset="utf-8"> <title>HTML5 or Native App?</title> <link rel="stylesheet" media="all" href="styles.css" type="text/css" /> <link rel="stylesheet" media="screen and (max-width: 500px)" href="mobile.css" type="text/css" /> <meta name = "viewport" content = "width=device-width, initial-scale=1.0, user-scalable=no"> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--></head>

Add a new stylesheet, mobile.css

Page 27: A brief introduction on HTML5 and responsive layouts

.wrap { margin: 5px; width: 100%;}

hgroup { padding-bottom: 20px; border-bottom: 1px dotted #aaa; margin-bottom: 20px;}

hgroup h1 { font-size: 32px;}

hgroup h2 { display: none;}

aside { display: none;}

figure { float: none; margin-left: auto; margin-right: auto;}

Page 28: A brief introduction on HTML5 and responsive layouts