+ All Categories
Home > Documents > HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the...

HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the...

Date post: 29-Dec-2015
Category:
Upload: eileen-myra-wilson
View: 224 times
Download: 0 times
Share this document with a friend
55
HTML Advanced: HTML 5 HTML Advanced: HTML 5
Transcript
Page 1: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML Advanced: HTML 5HTML Advanced: HTML 5

Page 2: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

Introduction to HTML 5Introduction to HTML 5

These slides are based on source material found at the w3schools.com website.

Page 3: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: What is it?HTML5: What is it?

HTML5 will be the new standard for HTML, HTML5 will be the new standard for HTML, XHTML, and the HTML DOM (document object XHTML, and the HTML DOM (document object model).model).

The previous version of HTML came in 1999. The previous version of HTML came in 1999. The web has changed a lot since then.The web has changed a lot since then.

HTML5 is still a work in progress, but most HTML5 is still a work in progress, but most modern browsers have some HTML5 support.modern browsers have some HTML5 support.

Page 4: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: OriginsHTML5: Origins

HTML5 is a cooperation between the World HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Hypertext Application Technology Working Group (WHATWG).Group (WHATWG).

WHATWG was working with web forms and WHATWG was working with web forms and applications, and W3C was working with applications, and W3C was working with XHTML 2.0. In 2006, they decided to XHTML 2.0. In 2006, they decided to cooperate and create a new version of cooperate and create a new version of HTML.HTML.

Page 5: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Ground RulesHTML5: Ground Rules

Some rules for HTML5 were established:Some rules for HTML5 were established:

>> New features should be based on HTML, New features should be based on HTML,

CSS, DOM, and JavaScriptCSS, DOM, and JavaScript

>> Reduce the need for external plugins Reduce the need for external plugins

>> Better error handling Better error handling

>> More markup to replace scripting More markup to replace scripting

>> HTML5 should be device independent HTML5 should be device independent

>> Dev process should be visible to the public Dev process should be visible to the public

Page 6: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: New FeaturesHTML5: New Features

Canvas element for drawingCanvas element for drawing Video/audio elements for media Video/audio elements for media

playbackplayback Better support for local offline storageBetter support for local offline storage New content specific elements, like New content specific elements, like

article, footer, header, nav, sectionarticle, footer, header, nav, section New form controls, like calendar, date, New form controls, like calendar, date,

time, email, url, searchtime, email, url, search

Page 7: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: SupportHTML5: Support

HTML5 is not yet an official standard, and HTML5 is not yet an official standard, and no browser has full HTML5 support.no browser has full HTML5 support.

Darn it.Darn it.

Page 8: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: SupportHTML5: Support

You may well ask: “How can I start using You may well ask: “How can I start using HTML5 if older browsers don’t support it?” HTML5 if older browsers don’t support it?” But the question itself is misleading.But the question itself is misleading.

HTML5 is not one big thing; it is a HTML5 is not one big thing; it is a collection of individual features. You can collection of individual features. You can only detect support for individual features, only detect support for individual features, like canvas, video, or geolocation.like canvas, video, or geolocation.

Page 9: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: SupportHTML5: Support

Love it or hate it, you can’t deny that HTML Love it or hate it, you can’t deny that HTML 4 is the most successful markup format 4 is the most successful markup format ever. HTML5 builds on that success. ever. HTML5 builds on that success.

You don’t need to throw away your existing You don’t need to throw away your existing markup. You don’t need to relearn things markup. You don’t need to relearn things you already know.you already know.If your web application worked yesterday If your web application worked yesterday in HTML 4, it will still work today in HTML5. in HTML 4, it will still work today in HTML5. Period.Period.

Page 10: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: ExampleHTML5: Example

HTML5 supports all the form controls from HTML5 supports all the form controls from HTML 4, but it also includes new input HTML 4, but it also includes new input controls.controls.

Some of these are long-overdue additions Some of these are long-overdue additions like sliders and date pickers; others are like sliders and date pickers; others are more subtle... more subtle...

Page 11: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: ExampleHTML5: Example

For example, the email input type looks For example, the email input type looks just like a text box, but mobile browsers just like a text box, but mobile browsers will customize their onscreen keyboard to will customize their onscreen keyboard to make it easier to type email addresses. make it easier to type email addresses.

Older browsers that don’t support the Older browsers that don’t support the email input type will treat it as a regular email input type will treat it as a regular text field, and the form still works with no text field, and the form still works with no markup changes or scripting hacks.markup changes or scripting hacks.

Page 12: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DOCTYPEHTML5: DOCTYPE

The DOCTYPE which comes before the beginning <html> The DOCTYPE which comes before the beginning <html> tag is much simpler in HTML 5. Here are some examples tag is much simpler in HTML 5. Here are some examples of what it looks like now...of what it looks like now...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">"http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd>

Page 13: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML: DOCTYPEHTML: DOCTYPE

Previous versions of HTML defined a lot of Previous versions of HTML defined a lot of doctypes, and choosing the right one doctypes, and choosing the right one could be tricky. In HTML5, there is only one could be tricky. In HTML5, there is only one doctype:doctype:

<!DOCTYPE html><!DOCTYPE html>

Page 14: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML: SupportHTML: Support

Whether you want to draw on a canvas, Whether you want to draw on a canvas, play video, design better forms, or build play video, design better forms, or build web applications that work offline, HTML5 web applications that work offline, HTML5 is already well-supported. is already well-supported.

Page 15: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML: SupportHTML: Support

Firefox, Safari, Chrome, Opera, and mobile Firefox, Safari, Chrome, Opera, and mobile browsers already support canvas, video, browsers already support canvas, video, geolocation, local storage, and more. geolocation, local storage, and more.

Google already supports microdata Google already supports microdata annotations.annotations.

Even Microsoft supports most HTML5 Even Microsoft supports most HTML5 features in Internet Explorer 9.features in Internet Explorer 9.

Page 16: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: MIME typesHTML5: MIME types

Every time your web browser requests a Every time your web browser requests a page, the web server sends “headers” page, the web server sends “headers” before it sends the actual page markup. before it sends the actual page markup.

Headers are important, because they tell Headers are important, because they tell your browser how to interpret the page your browser how to interpret the page markup that follows.markup that follows.

MIME = Multipurpose Internet Mail MIME = Multipurpose Internet Mail ExtensionsExtensions

Page 17: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: MIME typesHTML5: MIME types

The most important header is The most important header is called Content-Type, and it called Content-Type, and it looks like this:looks like this:

Content-Type: text/htmlContent-Type: text/html

““text/html” is called the text/html” is called the “content type” or “MIME “content type” or “MIME type” of the page.type” of the page.

Page 18: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: MIME typesHTML5: MIME types

This header is the only thing that determines This header is the only thing that determines what a particular resource truly is, and what a particular resource truly is, and therefore how it should be rendered.therefore how it should be rendered.Images have their own MIME types Images have their own MIME types (image/jpeg for JPEG images, image/png for (image/jpeg for JPEG images, image/png for PNG images, and so on). PNG images, and so on). JavaScript files have their own MIME type. JavaScript files have their own MIME type. CSS stylesheets have their own MIME type. CSS stylesheets have their own MIME type. Everything has its own MIME type.Everything has its own MIME type.The web runs on MIME types.The web runs on MIME types.

Page 19: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DetectionHTML5: Detection

When your browser renders a web page, it When your browser renders a web page, it constructs a constructs a Document Object ModelDocument Object Model, a , a collection of objects that represent the HTML collection of objects that represent the HTML elements on the page. Every element is elements on the page. Every element is represented in the DOM by a different object.represented in the DOM by a different object.

In browsers that support HTML5 features, In browsers that support HTML5 features, certain objects will have unique properties.certain objects will have unique properties.

A quick peek at the DOM will tell you which A quick peek at the DOM will tell you which features are supported.features are supported.

Page 20: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DetectionHTML5: Detection

[Modernizr][Modernizr] is an open source, MIT- is an open source, MIT-licensed JavaScript library that detects licensed JavaScript library that detects support for many HTML5 & CSS3 features. support for many HTML5 & CSS3 features.

To use it, include the following <script> To use it, include the following <script> element at the top of your page...element at the top of your page...

Page 21: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DetectionHTML5: Detection

<!DOCTYPE html><!DOCTYPE html><html><html><head><head> <meta charset="utf-8"><meta charset="utf-8"> <title>HTML5 sure is fun</title><title>HTML5 sure is fun</title> <script src="<script src="modernizr.min.jsmodernizr.min.js"></script>"></script></head></head><body><body> ......</body></body></html></html>

Page 22: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DetectionHTML5: Detection

Modernizr runs automatically.Modernizr runs automatically.

When it runs, it creates a global object When it runs, it creates a global object called Modernizr, that contains a set of called Modernizr, that contains a set of Boolean properties for each feature it can Boolean properties for each feature it can detect.detect.

For example, if your browser supports the For example, if your browser supports the canvas API, the Modernizr.canvas property canvas API, the Modernizr.canvas property will be true – otherwise the property will be will be true – otherwise the property will be false.false.

Page 23: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: DetectionHTML5: Detection

if (Modernizr.canvas) {if (Modernizr.canvas) {

// let's draw some shapes!// let's draw some shapes!

} else {} else {

// no native canvas support available :(// no native canvas support available :(

}}

More on HTML5 detection (and Modernizr) More on HTML5 detection (and Modernizr) here: here: http://diveintohtml5.org/detect.htmlhttp://diveintohtml5.org/detect.html

Page 24: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: What's NewHTML5: What's New

The internet has changed a lot since HTML 4.01 The internet has changed a lot since HTML 4.01 became a standard in 1999.became a standard in 1999.

Today, some elements in HTML 4.01 are Today, some elements in HTML 4.01 are obsolete, never used, or not used the way they obsolete, never used, or not used the way they were intended to be. These elements are were intended to be. These elements are deleted or re-written in HTML5.deleted or re-written in HTML5.

HTML5 also includes new elements for better HTML5 also includes new elements for better structure, drawing, media content, form structure, drawing, media content, form handling.handling.

Page 25: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: What's NewHTML5: What's New

New elements list: New elements list: http://www.w3schools.com/html5/http://www.w3schools.com/html5/

Some of the new markup elements are Some of the new markup elements are handy for creating better page structure. handy for creating better page structure.

Page 26: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: What's NewHTML5: What's New

Page 27: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

Until now, there hasn't been a standard for Until now, there hasn't been a standard for showing video on a web page.showing video on a web page.

Today, most videos are shown through a Today, most videos are shown through a plugin (like Flash). However, not all plugin (like Flash). However, not all browsers have the same plugins.browsers have the same plugins.

HTML5 specifies a standard way to include HTML5 specifies a standard way to include video with the video element.video with the video element.

Page 28: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

Currently, there are 3 supported video Currently, there are 3 supported video formats for the video element:formats for the video element:

Page 29: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

<!DOCTYPE HTML><!DOCTYPE HTML><html><html><body><body>

<video src="movie.ogg" width="320" height="240" <video src="movie.ogg" width="320" height="240" controls="controls">controls="controls">Your browser does not support the video tag.Your browser does not support the video tag.</video></video>

</body></body></html></html>

Page 30: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

The last example uses an Ogg file, and will The last example uses an Ogg file, and will work in Firefox, Opera and Chrome.work in Firefox, Opera and Chrome.

To make the video work in Safari and future To make the video work in Safari and future versions of Chrome, we must add an MPEG4 versions of Chrome, we must add an MPEG4 and WebM file.and WebM file.

The video element allows multiple source The video element allows multiple source elements. Source elements can link to different elements. Source elements can link to different video files. The browser will use the first video files. The browser will use the first recognized format:recognized format:

Page 31: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

<video width="320" height="240" <video width="320" height="240" controls="controls">controls="controls">

<source src="movie.ogg" type="video/ogg" /><source src="movie.ogg" type="video/ogg" />

<source src="movie.mp4" type="video/mp4" /><source src="movie.mp4" type="video/mp4" />

<source src="movie.webm" type="video/webm" /><source src="movie.webm" type="video/webm" />

Your browser does not support the video tag.Your browser does not support the video tag.

</video> </video>

Page 32: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

<sarcasm>Surprising fact...</sarcasm><sarcasm>Surprising fact...</sarcasm>

Internet Explorer 8 does not support the Internet Explorer 8 does not support the video element. In IE 9, there will be support video element. In IE 9, there will be support for video element using MPEG4.for video element using MPEG4.

Page 33: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: VideoHTML5: Video

Page 34: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

Until now, there has never been a standard for Until now, there has never been a standard for playing audio on a web page.playing audio on a web page.

Today, most audio is played through a plugin Today, most audio is played through a plugin (like Flash). However, not all browsers have the (like Flash). However, not all browsers have the same plugins.same plugins.

HTML5 specifies a standard way to include HTML5 specifies a standard way to include audio, with the audio element. The audio audio, with the audio element. The audio element can play sound files, or an audio element can play sound files, or an audio stream.stream.

Page 35: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

Currently, there are 3 supported formats Currently, there are 3 supported formats for the audio element:for the audio element:

Page 36: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

<!DOCTYPE HTML><!DOCTYPE HTML>

<html><html>

<body><body>

<audio src="song.ogg" controls="controls"><audio src="song.ogg" controls="controls">

Your browser does not support the audio element.Your browser does not support the audio element.

</audio></audio>

</body></body>

</html></html>

Page 37: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

The last example uses an Ogg file, and will The last example uses an Ogg file, and will work in Firefox, Opera and Chrome.work in Firefox, Opera and Chrome.

To make the audio work in Safari, the audio To make the audio work in Safari, the audio file must be of type MP3 or Wav.file must be of type MP3 or Wav.

The audio element allows multiple source The audio element allows multiple source elements. Source elements can link to elements. Source elements can link to different audio files. The browser will use different audio files. The browser will use the first recognized format.the first recognized format.

Page 38: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

<audio controls="controls"><audio controls="controls">

<source src="song.ogg" type="audio/ogg" /><source src="song.ogg" type="audio/ogg" />

<source src="song.mp3" <source src="song.mp3" type="audio/mpeg" />type="audio/mpeg" />

Your browser does not support the audio Your browser does not support the audio element.element.

</audio> </audio>

Page 39: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

Another fact: Another fact: Internet Explorer 8 does not Internet Explorer 8 does not support the audio element. In IE 9, there support the audio element. In IE 9, there will be support for audio element.will be support for audio element.

Page 40: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: AudioHTML5: Audio

Page 41: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: CanvasHTML5: Canvas

The HTML5 canvas element uses The HTML5 canvas element uses JavaScript to draw graphics on a web JavaScript to draw graphics on a web page.page.

A canvas is a rectangular area, and you A canvas is a rectangular area, and you control every pixel of it.control every pixel of it.

The canvas element has several methods The canvas element has several methods for drawing paths, boxes, circles, for drawing paths, boxes, circles, characters, and adding images.characters, and adding images.

Page 42: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: CanvasHTML5: Canvas

Adding a canvas element to the HTML5 Adding a canvas element to the HTML5 page.page.

Specify the id, width, height of the Specify the id, width, height of the element:element:

<canvas id="myCanvas" width="200" <canvas id="myCanvas" width="200" height="100"></canvas> height="100"></canvas>

Page 43: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: CanvasHTML5: Canvas

The canvas element has no drawing abilities of its The canvas element has no drawing abilities of its own. All drawing must be done inside a JavaScript:own. All drawing must be done inside a JavaScript:

<script type="text/javascript"><script type="text/javascript">var c=document.getElementById("myCanvas");var c=document.getElementById("myCanvas");var cxt=c.getContext("2d");var cxt=c.getContext("2d");cxt.fillStyle="#FF0000";cxt.fillStyle="#FF0000";cxt.fillRect(0,0,150,75);cxt.fillRect(0,0,150,75);</script></script>

Visit the sandbox >>Visit the sandbox >>

Page 44: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Web StorageHTML5: Web Storage

For information about web storage:For information about web storage:

http://www.w3schools.com/html5/http://www.w3schools.com/html5/

Page 45: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input typesHTML5: Input types

HTML5 has several new input types for forms:HTML5 has several new input types for forms: emailemail urlurl numbernumber rangerange date pickers (date, month, week, time,date pickers (date, month, week, time, datetime, datetime-local) datetime, datetime-local) searchsearch colorcolor

Page 46: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input e-mailHTML5: Input e-mail

The email type is used for input fields that should The email type is used for input fields that should contain an e-mail address.contain an e-mail address.

The value of the email field is automatically The value of the email field is automatically validated when the form is submitted.validated when the form is submitted.

E-mail: <input type="email" name="user_email" />E-mail: <input type="email" name="user_email" />

Tip: Safari on the iPhone recognizes the email Tip: Safari on the iPhone recognizes the email input type, and changes the on-screen keyboard input type, and changes the on-screen keyboard to match it (adds @ and .com options).to match it (adds @ and .com options).

Page 47: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input - urlHTML5: Input - url

The url type is used for input fields that should The url type is used for input fields that should contain a URL address.contain a URL address.

The value of the url field is automatically validated The value of the url field is automatically validated when the form is submitted.when the form is submitted.

Homepage: <input type="url" name="user_url" />Homepage: <input type="url" name="user_url" />

Tip: Safari on the iPhone recognizes the url input Tip: Safari on the iPhone recognizes the url input type, and changes the on-screen keyboard to type, and changes the on-screen keyboard to match it (adds .com option).match it (adds .com option).

Page 48: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input - numberHTML5: Input - numberThe number type is used for input fields that The number type is used for input fields that should contain a numeric value.should contain a numeric value.

Set restrictions on what numbers are accepted:Set restrictions on what numbers are accepted:

Points: <input type="number" name="points" Points: <input type="number" name="points" min="1" max="10" />min="1" max="10" />

Page 49: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input - rangeHTML5: Input - range

The range type is used for input fields that should The range type is used for input fields that should contain a value from a range of numbers.contain a value from a range of numbers.

The range type is displayed as a slider bar.The range type is displayed as a slider bar.

You can also set restrictions on what numbers are You can also set restrictions on what numbers are accepted:accepted:

<input type="range" name="points" min="1" <input type="range" name="points" min="1" max="10" />max="10" />

Page 50: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input – date pickersHTML5: Input – date pickers

HTML5 has several new input types for selecting HTML5 has several new input types for selecting date and time:date and time:

date - Selects date, month and yeardate - Selects date, month and year month - Selects month and yearmonth - Selects month and year week - Selects week and yearweek - Selects week and year time - Selects time (hour and minute)time - Selects time (hour and minute) datetime - Selects time, date, month and yeardatetime - Selects time, date, month and year datetime-local - Selects time, date, month anddatetime-local - Selects time, date, month and year (local time) year (local time)

Page 51: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input - searchHTML5: Input - search

The search type is used for search fields The search type is used for search fields like a site search or Google search.like a site search or Google search.

The search field behaves like a regular text The search field behaves like a regular text field.field.

Page 52: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input – color pickerHTML5: Input – color picker

The color type is used for input fields that The color type is used for input fields that should contain a color.should contain a color.

This input type will allow you to select a This input type will allow you to select a color from a color picker:color from a color picker:

Color: <input type="color" Color: <input type="color" name="user_color" />name="user_color" />

Page 53: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Input - formHTML5: Input - form

HTML5 has several new elements and HTML5 has several new elements and attributes for forms.attributes for forms. datalistdatalist keygenkeygen outputoutput

Page 54: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: Form elementsHTML5: Form elements

The datalist element specifies a list of options The datalist element specifies a list of options for an input field. The list is created with option for an input field. The list is created with option elements inside the datalist.elements inside the datalist.

The purpose of the keygen element is to The purpose of the keygen element is to provide a secure way to authenticate users.provide a secure way to authenticate users.

The output element is used for different types The output element is used for different types of output, like calculations or script output:of output, like calculations or script output:

Page 55: HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.

HTML5: ReferenceHTML5: Reference

http://www.w3schools.com/html5http://www.w3schools.com/html5


Recommended