SlideShare a Scribd company logo
HTML 5 New Tags, New Attributes, New JavaScript APIs, Forms, Validation, Audio, Video, SVG, Canvas Doncho Minkov Telerik Mobile Development Course mobiledevcourse.telerik.com Technical Trainer http://www.minkov.it
Table of Contents Introduction to HTML 5 Changed Old Tags New Tags Audio and Video Tags New Structural Tags ( <header> ,  <footer> , …) New Form Elements and Validation New Attributes Canvas vs. SVG Local Storage
Introduction to HTML 5 What the … is HTML 5?
What is HTML 5? HTML5 – the next major revision of the HTML Currently under development Far away from final version Developed under the HTML 5 working group of the World Wide Web Consortium (W3C) in 2007 First Public Working Draft of the specification January 22, 2008 Parts of HTML5 are being implemented in browsers before the whole specification is ready
HTML – Past, Present, Future 1991 – HTML first mentioned – Tim Berners-Lee – HTML tags 1993 – HTML (first public version, published at IETF) 1993 – HTML 2 draft 1995 – HTML 2 – W3C 1995 – HTML 3 draft  1997 – HTML 3.2 – “Wilbur” 1997 – HTML 4 – ”Cougar” – CSS  1999 – HTML 4.01 (final) 2000 – XHTML draft  2001 – XHTML  (final) 2008 – HTML5 / XHTML5 draft 2011 – feature complete HTML5 2022 – HTML5 – final specification
HTML 5 Goals Latest version is HTML5 Aimed to have all of the power of native applications Run on any platform (Windows, Linux, iPhone, Android, etc.) New features should be based on HTML, CSS, DOM and JavaScript Reduce the need for external plugins Better error handling More markup to replace scripting
Designer Outlook What a Designer Should Know?
Changed Old Tags Doctype tag: HTML tag: Meta tag: Link tag: <!DOCTYPE html> <html lang=&quot;en&quot; xml:lang=&quot;en&quot;>  <meta charset=&quot;utf-8&quot;>  <link rel=&quot;stylesheet&quot; href=&quot;style-original.css&quot;>
New Layout Sctucture Better layout structure: new structural elements <section> <header> <nav> <article> <aside> <footer> <header> <footer> <nav> <aside> <section> <header> <article> <footer>
New Layout Sctucture (2) Elements like header and footer are not meant to be only at the top and bottom of the page Header and footer of each document section  Not very different from  <DIV > tag but are more semantically well defined in the document structure
New Layout Sctucture  – Example <body> <header> <hgroup>        <h1>HTML 5 Presentation</h1>        <h2>New Layout Structure</h2>      </hgroup>    </header> <nav>      <ul> Lecture      </ul> <ul> Demos      </ul> <ul> Trainers      </ul>    </nav> 
New Layout Sctucture  – Example (2) <section>     <article>       <header>          <h1>First Paragraph</h1>        </header>    <section>    Some text    </section>      </article> </section>     <aside>      <a href=&quot;http://academy.telerik.com&quot;> more info</a>    </aside>    <footer>      Done by Doncho Minkov, (c) 2011, Telerik Academy    </footer> </body>
New Layout Structure Tags Live Demo
New Tags <article> For external content, like text from a news-article, blog, forum, or any other external source <aside> For content aside from (but related to) the content it is placed in <details> For describing details about a document, or parts of a document <summary> A caption, or summary, inside the details element
New Tags (2) <mark> For text that should be highlighted <nav> For a section of navigation <section>  For a section in a document (e.g. chapters, headers, footers) <wbr> Word break.  For defining an appropriate place to break a long word or sentence Other tags <command> ,   <datalist> ,  <details> ,   <progress > , etc.
New Media Tags Media Tags <audio> Attributes:  autoplay ,  controls ,  loop ,  src <video> Attributes:  autoplay ,  controls ,  loop ,  height ,  width ,  src <audio width=&quot;360&quot; height=&quot;240&quot; controls= &quot;controls&quot; >  <source src=&quot;someSong.mp3&quot; type=&quot;audio/mp3&quot;>  </source> Audio tag is not supported </audio>
Playing Audio Live Demo
Embed Tag – New Syntax <embed> Defines embedded content,  such as a plug-in Attributes src=&quot;url&quot; ,  type=&quot;type&quot; <embed src=&quot;helloworld.swf&quot; />
New Attributes New attributes Attribute Description Autocomplete ON / OFF . In case of “ on ”, the browser stores the value, auto fill when the user visits the same form next time  Autofocus Autofocus . Input field is focused on page load Required Required . Mandates input field value for the form submit action Draggable True / false  indicates if the element is draggable or not
New <input> Types New  <input>   type(s) Attribute Description Number/Range Restricts users to enter only numbers. Additional attributes  min ,  max  and  step  and  value  can convert the input to a  slider   control   or a  spin   box date, month, week, time, date + time, and date + time - time zone Providers a  date   picker   interface. Email Input type for  Email   Addresses URL Input field for  URL address Telephone Input type for  Telephone   number
New Form Tags: <input type=&quot;range&quot;> Live Demo
Built-In Forms Validation Live Demo
Canvas vs. SVG
Canvas Allows dynamic, scriptable rendering of 2D shapes and bitmap images Low level, procedural model  Updates a bitmap Does not have a built-in scene graph Consists of a drawable region defined in HTML  Has height and width attributes Accessible by JavaScript Code Used for building graphs, animations, games, and image composition
Canvas Example In HTML: <canvas id=&quot;example&quot; width=&quot;200&quot; height=&quot;200&quot;> This is displayed if HTML5 Canvas is not supported. </canvas> Access with JavaScript: var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = &quot;rgb(255,0,0)&quot;; context.fillRect(30, 30, 50, 50);
Canvas Example In HTML: <canvas id=&quot;example&quot; width=&quot;200&quot; height=&quot;200&quot;> This is displayed if HTML5 Canvas is not supported. </canvas> Access with JavaScript: var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = &quot;rgb(255,0,0)&quot;; context.fillRect(30, 30, 50, 50);
SVG SVG stands for  S calable  V ector  G raphics  A language for describing 2D-graphics  Graphical applications Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG Internet Explorer users may have to install the  Adobe SVG Viewer HTML5  allows embedding  SVG   Directly using  <svg> ... </svg>   https://developer.mozilla.org/en/SVG
SVG Example <!DOCTYPE html> <head> <title>SVG</title> <meta charset=&quot;utf-8&quot; /> </head> <body> <h2>HTML5 SVG Circle</h2> <svg id=&quot;svgelem&quot; height=&quot;200&quot;  xmlns=&quot;http://www.w3.org/2000/svg&quot;> <circle id=&quot;redcircle&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot;  fill=&quot;red&quot; /> </svg> </body> </html>
SVG Gradient Example <svg id=&quot;svgelem&quot; height=&quot;200&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;> <defs> <radialGradient id=&quot;gradient&quot; cx=&quot;50%&quot; cy=&quot;50%&quot;  r=&quot;50%&quot; fx=&quot;50%&quot; fy=&quot;50%&quot;> <stop offset=&quot;0%&quot;  style=&quot;stop-color:rgb(200,200,200);stop-opacity:0&quot;/> <stop offset=&quot;100%&quot;  style=&quot;stop-color:rgb(0,0,255);stop-opacity:1&quot;/> </radialGradient> </defs> <ellipse cx=&quot;100&quot; cy=&quot;50&quot; rx=&quot;100&quot; ry=&quot;50&quot;  style=&quot;fill:url(#gradient)&quot; /> </svg>
Canvas vs. SVG Live Demo
Local Storage More persistent than temporary internet files and cookies Most useful for (mobile) devices that are not connected to the Internet all the time, or when bandwidth is scarce More storage space available - 5MB limit per domain (recommended by W3C), compared to 4KB per cookie
Local Storage Demo HTML <form> <fieldset> <label for=&quot;value&quot;>enter key name:</label> <input type=&quot;text&quot; id=&quot;key&quot; /> <label for=&quot;value&quot;>enter key value:</label> <input type=&quot;text&quot; id=&quot;value&quot; /> </fieldset> <fieldset> <button type=&quot;button&quot; onclick=&quot;setValue()&quot;> store the key value</button> <button type=&quot;button&quot; onclick=&quot;getValue()&quot;> retrieve the key value</button> <button type=&quot;button&quot; onclick=&quot;getCount()&quot;> retrieve the number of keys</button> <button type=&quot;button&quot; onclick=&quot;clearAll()&quot;> clear all key values</button> </fieldset> </form>
Local Storage Demo Script var $ = function (id) { return document.getElementById(id); } function setValue() { window.localStorage.setItem($(&quot;key&quot;).value, $(&quot;value&quot;).value); } function getValue() { alert(window.localStorage.getItem($(&quot;key&quot;).value)); } function getCount() {alert(window.localStorage.length);} function clearAll() {window.localStorage.clear();}
End User Outlook What is the Advantage to the End User?
HTML 5 – End User Outlook Provides a very rich user experience without Plug-ins RIA replacement? Better Performance Leverages GPU for better graphical experience
How to Detect HTML5? HTML5 is not a thing someone can detect It consists of many elements that can be detected <canvas> ,  <video> , etc. The HTML5 specification defines how tags interact with JavaScript Through the  D ocument  O bject  M odel ( DOM ) HTML5 doesn’t just define a  <video>  tag There is also a corresponding DOM API for video objects in the DOM You can use this API to detect support for different video formats, etc.
HTML 5 – Showcases and Resources HTML 5 Rocks – Examples, Demos, Tutorials http://www.html5rocks.com/ HTML 5 Demos http ://html5demos.com / Internet Explorer 9 Test Drive for HTML 5 http ://ie.microsoft.com/testdrive/ Apple Safari HTML 5 Showcases http://www.apple.com/html5 / Dive into HTML 5 http://diveintohtml5.org/
HTML 5 Questions?
Homework Make the following Web Page. Note that there should be validators for emails and url (email and url are required fields) Using the previously made Web Page, add  functionality to check if the text in &quot;email&quot; and &quot;repeat email&quot; fields  is equal. If not show warning message and  reload the page
Using Canvas draw the following figures Try doing the same using SVG Hint: Use JavaScript Homework (2)
Homework (3) Build the following Web Page using HTML5 and CSS 2.1 Use &quot;Lorem Ipsum&quot; to fill with some sample Content Try to make  the page look OK when the window  is resized

More Related Content

PPT
HTML5 Fundamentals
PPT
Ajax
PPT
Html5 Overview
PPTX
HTML5 Tags and Elements Tutorial
PPTX
HTML/HTML5
PDF
HTML5: features with examples
ODP
PPTX
Html5 and-css3-overview
HTML5 Fundamentals
Ajax
Html5 Overview
HTML5 Tags and Elements Tutorial
HTML/HTML5
HTML5: features with examples
Html5 and-css3-overview

What's hot (19)

PDF
Michael(tm) Smith ED09 presentation
PPT
HTML 5 Overview
PPTX
HTML5 Tutorial
ODP
Creating Web Sites with HTML and CSS
PPTX
HTML5 introduction for beginners
PPTX
Html5 Basic Structure
PDF
Html 5 New Features
PDF
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
PPTX
PPTX
Html 5 tutorial - By Bally Chohan
PPTX
Html 5.0
PPTX
Html5 tutorial for beginners
PPTX
Html basic tags
KEY
An Introduction to HTML5
PDF
HTML5 & Friends
PPTX
Css, xhtml, javascript
PPT
WordPress Development Confoo 2010
ZIP
Looking into HTML5
Michael(tm) Smith ED09 presentation
HTML 5 Overview
HTML5 Tutorial
Creating Web Sites with HTML and CSS
HTML5 introduction for beginners
Html5 Basic Structure
Html 5 New Features
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
Html 5 tutorial - By Bally Chohan
Html 5.0
Html5 tutorial for beginners
Html basic tags
An Introduction to HTML5
HTML5 & Friends
Css, xhtml, javascript
WordPress Development Confoo 2010
Looking into HTML5
Ad

Viewers also liked (12)

PDF
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
PPTX
[SoftServe IT Academy] JavaScript Forms
PDF
JavaScript
PPT
Flex security
PPTX
02. input validation module v5
PPT
HTML5 Mullet: Forms & Input Validation
PPTX
Javascript validating form
PPT
Web forms and server side scripting
PPTX
Form Validation in JavaScript
DOCX
Validation rule, validation text and input masks
PDF
HTML5 JavaScript APIs
PDF
TEDx Manchester: AI & The Future of Work
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
[SoftServe IT Academy] JavaScript Forms
JavaScript
Flex security
02. input validation module v5
HTML5 Mullet: Forms & Input Validation
Javascript validating form
Web forms and server side scripting
Form Validation in JavaScript
Validation rule, validation text and input masks
HTML5 JavaScript APIs
TEDx Manchester: AI & The Future of Work
Ad

Similar to HTML5 (20)

PPTX
Peter lubbers-html5-overview-sf-dev-conf-2011
PPT
Filling the HTML5 Gaps with Polyfills and Shims
PPTX
Using HTML5 and CSS3 today
PPT
HTML5 Overview
ODP
PPT
introduction to web technology
PPT
Yahoo Mobile Widgets
PPT
BluePrint Mobile Framework
PPTX
HTML5
KEY
HTML5 - techMaine Presentation 5/18/09
PPT
Html5: What is it?
PPTX
HTML5 - One spec to rule them all
PPT
PPT
HTML5 with examples
PPT
PPT
PPTX
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
PPT
Webpages And Dynamic Content
PPTX
The current status of html5 technology and standard
PPT
What I brought back from Austin
Peter lubbers-html5-overview-sf-dev-conf-2011
Filling the HTML5 Gaps with Polyfills and Shims
Using HTML5 and CSS3 today
HTML5 Overview
introduction to web technology
Yahoo Mobile Widgets
BluePrint Mobile Framework
HTML5
HTML5 - techMaine Presentation 5/18/09
Html5: What is it?
HTML5 - One spec to rule them all
HTML5 with examples
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Webpages And Dynamic Content
The current status of html5 technology and standard
What I brought back from Austin

More from Doncho Minkov (20)

PDF
Web Design Concepts
PPT
Web design Tools
PPT
PPT
HTML 5 Tables and Forms
PPT
CSS Overview
PPT
CSS Presentation
PPT
CSS Layout
PPT
PPT
Adobe Photoshop
PPT
Slice and Dice
PPT
Introduction to XAML and WPF
PPT
WPF Layout Containers
PPT
WPF Controls
PPT
WPF Templating and Styling
PPT
WPF Graphics and Animations
PPT
Simple Data Binding
PPT
Complex Data Binding
PPT
WPF Concepts
PPT
Model View ViewModel
PPT
WPF and Databases
Web Design Concepts
Web design Tools
HTML 5 Tables and Forms
CSS Overview
CSS Presentation
CSS Layout
Adobe Photoshop
Slice and Dice
Introduction to XAML and WPF
WPF Layout Containers
WPF Controls
WPF Templating and Styling
WPF Graphics and Animations
Simple Data Binding
Complex Data Binding
WPF Concepts
Model View ViewModel
WPF and Databases

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
Understanding_Digital_Forensics_Presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

HTML5

  • 1. HTML 5 New Tags, New Attributes, New JavaScript APIs, Forms, Validation, Audio, Video, SVG, Canvas Doncho Minkov Telerik Mobile Development Course mobiledevcourse.telerik.com Technical Trainer http://www.minkov.it
  • 2. Table of Contents Introduction to HTML 5 Changed Old Tags New Tags Audio and Video Tags New Structural Tags ( <header> , <footer> , …) New Form Elements and Validation New Attributes Canvas vs. SVG Local Storage
  • 3. Introduction to HTML 5 What the … is HTML 5?
  • 4. What is HTML 5? HTML5 – the next major revision of the HTML Currently under development Far away from final version Developed under the HTML 5 working group of the World Wide Web Consortium (W3C) in 2007 First Public Working Draft of the specification January 22, 2008 Parts of HTML5 are being implemented in browsers before the whole specification is ready
  • 5. HTML – Past, Present, Future 1991 – HTML first mentioned – Tim Berners-Lee – HTML tags 1993 – HTML (first public version, published at IETF) 1993 – HTML 2 draft 1995 – HTML 2 – W3C 1995 – HTML 3 draft 1997 – HTML 3.2 – “Wilbur” 1997 – HTML 4 – ”Cougar” – CSS 1999 – HTML 4.01 (final) 2000 – XHTML draft 2001 – XHTML (final) 2008 – HTML5 / XHTML5 draft 2011 – feature complete HTML5 2022 – HTML5 – final specification
  • 6. HTML 5 Goals Latest version is HTML5 Aimed to have all of the power of native applications Run on any platform (Windows, Linux, iPhone, Android, etc.) New features should be based on HTML, CSS, DOM and JavaScript Reduce the need for external plugins Better error handling More markup to replace scripting
  • 7. Designer Outlook What a Designer Should Know?
  • 8. Changed Old Tags Doctype tag: HTML tag: Meta tag: Link tag: <!DOCTYPE html> <html lang=&quot;en&quot; xml:lang=&quot;en&quot;> <meta charset=&quot;utf-8&quot;> <link rel=&quot;stylesheet&quot; href=&quot;style-original.css&quot;>
  • 9. New Layout Sctucture Better layout structure: new structural elements <section> <header> <nav> <article> <aside> <footer> <header> <footer> <nav> <aside> <section> <header> <article> <footer>
  • 10. New Layout Sctucture (2) Elements like header and footer are not meant to be only at the top and bottom of the page Header and footer of each document section Not very different from <DIV > tag but are more semantically well defined in the document structure
  • 11. New Layout Sctucture – Example <body> <header> <hgroup>        <h1>HTML 5 Presentation</h1>        <h2>New Layout Structure</h2>     </hgroup>    </header> <nav>      <ul> Lecture      </ul> <ul> Demos      </ul> <ul> Trainers      </ul>    </nav> 
  • 12. New Layout Sctucture – Example (2) <section>    <article>      <header>          <h1>First Paragraph</h1>        </header>   <section>   Some text   </section>     </article> </section>    <aside>      <a href=&quot;http://academy.telerik.com&quot;> more info</a>    </aside>    <footer>      Done by Doncho Minkov, (c) 2011, Telerik Academy    </footer> </body>
  • 13. New Layout Structure Tags Live Demo
  • 14. New Tags <article> For external content, like text from a news-article, blog, forum, or any other external source <aside> For content aside from (but related to) the content it is placed in <details> For describing details about a document, or parts of a document <summary> A caption, or summary, inside the details element
  • 15. New Tags (2) <mark> For text that should be highlighted <nav> For a section of navigation <section> For a section in a document (e.g. chapters, headers, footers) <wbr> Word break. For defining an appropriate place to break a long word or sentence Other tags <command> , <datalist> , <details> , <progress > , etc.
  • 16. New Media Tags Media Tags <audio> Attributes: autoplay , controls , loop , src <video> Attributes: autoplay , controls , loop , height , width , src <audio width=&quot;360&quot; height=&quot;240&quot; controls= &quot;controls&quot; > <source src=&quot;someSong.mp3&quot; type=&quot;audio/mp3&quot;> </source> Audio tag is not supported </audio>
  • 18. Embed Tag – New Syntax <embed> Defines embedded content, such as a plug-in Attributes src=&quot;url&quot; , type=&quot;type&quot; <embed src=&quot;helloworld.swf&quot; />
  • 19. New Attributes New attributes Attribute Description Autocomplete ON / OFF . In case of “ on ”, the browser stores the value, auto fill when the user visits the same form next time Autofocus Autofocus . Input field is focused on page load Required Required . Mandates input field value for the form submit action Draggable True / false indicates if the element is draggable or not
  • 20. New <input> Types New <input> type(s) Attribute Description Number/Range Restricts users to enter only numbers. Additional attributes min , max and step and value can convert the input to a slider control or a spin box date, month, week, time, date + time, and date + time - time zone Providers a date picker interface. Email Input type for Email Addresses URL Input field for URL address Telephone Input type for Telephone number
  • 21. New Form Tags: <input type=&quot;range&quot;> Live Demo
  • 24. Canvas Allows dynamic, scriptable rendering of 2D shapes and bitmap images Low level, procedural model Updates a bitmap Does not have a built-in scene graph Consists of a drawable region defined in HTML Has height and width attributes Accessible by JavaScript Code Used for building graphs, animations, games, and image composition
  • 25. Canvas Example In HTML: <canvas id=&quot;example&quot; width=&quot;200&quot; height=&quot;200&quot;> This is displayed if HTML5 Canvas is not supported. </canvas> Access with JavaScript: var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = &quot;rgb(255,0,0)&quot;; context.fillRect(30, 30, 50, 50);
  • 26. Canvas Example In HTML: <canvas id=&quot;example&quot; width=&quot;200&quot; height=&quot;200&quot;> This is displayed if HTML5 Canvas is not supported. </canvas> Access with JavaScript: var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = &quot;rgb(255,0,0)&quot;; context.fillRect(30, 30, 50, 50);
  • 27. SVG SVG stands for S calable V ector G raphics A language for describing 2D-graphics Graphical applications Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG Internet Explorer users may have to install the Adobe SVG Viewer HTML5 allows embedding SVG Directly using <svg> ... </svg> https://developer.mozilla.org/en/SVG
  • 28. SVG Example <!DOCTYPE html> <head> <title>SVG</title> <meta charset=&quot;utf-8&quot; /> </head> <body> <h2>HTML5 SVG Circle</h2> <svg id=&quot;svgelem&quot; height=&quot;200&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;> <circle id=&quot;redcircle&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot; fill=&quot;red&quot; /> </svg> </body> </html>
  • 29. SVG Gradient Example <svg id=&quot;svgelem&quot; height=&quot;200&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;> <defs> <radialGradient id=&quot;gradient&quot; cx=&quot;50%&quot; cy=&quot;50%&quot; r=&quot;50%&quot; fx=&quot;50%&quot; fy=&quot;50%&quot;> <stop offset=&quot;0%&quot; style=&quot;stop-color:rgb(200,200,200);stop-opacity:0&quot;/> <stop offset=&quot;100%&quot; style=&quot;stop-color:rgb(0,0,255);stop-opacity:1&quot;/> </radialGradient> </defs> <ellipse cx=&quot;100&quot; cy=&quot;50&quot; rx=&quot;100&quot; ry=&quot;50&quot; style=&quot;fill:url(#gradient)&quot; /> </svg>
  • 30. Canvas vs. SVG Live Demo
  • 31. Local Storage More persistent than temporary internet files and cookies Most useful for (mobile) devices that are not connected to the Internet all the time, or when bandwidth is scarce More storage space available - 5MB limit per domain (recommended by W3C), compared to 4KB per cookie
  • 32. Local Storage Demo HTML <form> <fieldset> <label for=&quot;value&quot;>enter key name:</label> <input type=&quot;text&quot; id=&quot;key&quot; /> <label for=&quot;value&quot;>enter key value:</label> <input type=&quot;text&quot; id=&quot;value&quot; /> </fieldset> <fieldset> <button type=&quot;button&quot; onclick=&quot;setValue()&quot;> store the key value</button> <button type=&quot;button&quot; onclick=&quot;getValue()&quot;> retrieve the key value</button> <button type=&quot;button&quot; onclick=&quot;getCount()&quot;> retrieve the number of keys</button> <button type=&quot;button&quot; onclick=&quot;clearAll()&quot;> clear all key values</button> </fieldset> </form>
  • 33. Local Storage Demo Script var $ = function (id) { return document.getElementById(id); } function setValue() { window.localStorage.setItem($(&quot;key&quot;).value, $(&quot;value&quot;).value); } function getValue() { alert(window.localStorage.getItem($(&quot;key&quot;).value)); } function getCount() {alert(window.localStorage.length);} function clearAll() {window.localStorage.clear();}
  • 34. End User Outlook What is the Advantage to the End User?
  • 35. HTML 5 – End User Outlook Provides a very rich user experience without Plug-ins RIA replacement? Better Performance Leverages GPU for better graphical experience
  • 36. How to Detect HTML5? HTML5 is not a thing someone can detect It consists of many elements that can be detected <canvas> , <video> , etc. The HTML5 specification defines how tags interact with JavaScript Through the D ocument O bject M odel ( DOM ) HTML5 doesn’t just define a <video> tag There is also a corresponding DOM API for video objects in the DOM You can use this API to detect support for different video formats, etc.
  • 37. HTML 5 – Showcases and Resources HTML 5 Rocks – Examples, Demos, Tutorials http://www.html5rocks.com/ HTML 5 Demos http ://html5demos.com / Internet Explorer 9 Test Drive for HTML 5 http ://ie.microsoft.com/testdrive/ Apple Safari HTML 5 Showcases http://www.apple.com/html5 / Dive into HTML 5 http://diveintohtml5.org/
  • 39. Homework Make the following Web Page. Note that there should be validators for emails and url (email and url are required fields) Using the previously made Web Page, add functionality to check if the text in &quot;email&quot; and &quot;repeat email&quot; fields is equal. If not show warning message and reload the page
  • 40. Using Canvas draw the following figures Try doing the same using SVG Hint: Use JavaScript Homework (2)
  • 41. Homework (3) Build the following Web Page using HTML5 and CSS 2.1 Use &quot;Lorem Ipsum&quot; to fill with some sample Content Try to make the page look OK when the window is resized