What is HTML5? The previous version of HTML came in The web has changed a lot since then.

Similar documents
HTML5. Language of the Modern Web. By: Mayur Agrawal. Copyright TIBCO Software Inc.

footer, header, nav, section. search. ! Better Accessibility.! Cleaner Code. ! Smarter Storage.! Better Interactions.

HTML5 - INTERVIEW QUESTIONS

16. HTML5, HTML Graphics, & HTML Media 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과

Techno Expert Solutions An institute for specialized studies!

HTML5 INTRODUCTION & SEMANTICS

HTML5 INTRODUCTION & SEMANTICS

INTRODUCTION TO HTML5! HTML5 Page Structure!

HTML5 INTRODUCTION & SEMANTICS

HTML5 MOCK TEST HTML5 MOCK TEST I

HTML Forms. CITS3403 Agile Web Development. 2018, Semester 1

Top Trends in elearning. September 15 & 16, Is HTML5 Ready for elearning? Debbie Richards, Creative Interactive Ideas

Everything you need to know to get you started. By Kevin DeRudder

HTML HTML/XHTML HTML / XHTML HTML HTML: XHTML: (extensible HTML) Loose syntax Few syntactic rules: not enforced by HTML processors.

HTML5: MULTIMEDIA. Multimedia. Multimedia Formats. Common Video Formats

PIC 40A. Lecture 4b: New elements in HTML5. Copyright 2011 Jukka Virtanen UCLA 1 04/09/14

New Media Production HTML5

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Helper Applications & Plug-Ins

HTML 5 and CSS 3, Illustrated Complete. Unit K: Incorporating Video and Audio

CMPT 165 Notes on HTML5

Developer's HTML5. Cookbook. AAddison-Wesley. Chuck Hudson. Tom Leadbetter. Upper Saddle River, NJ Boston Indianapolis San Francisco

MODULE 2 HTML 5 FUNDAMENTALS. HyperText. > Douglas Engelbart ( )

COPYRIGHTED MATERIAL. Defining HTML5. Lesson 1

CITS3403 Agile Web Development Semester 1, 2016

HTML5 and CSS3: New Markup & Styles for the Emerging Web. Jason Clark Head of Digital Access & Web Services Montana State University Library

HTML5 is the next major revision of the HTML standard, currently under development

HTML5. Internet Engineering. Spring Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

NEW WEBMASTER HTML & CSS FOR BEGINNERS COURSE SYNOPSIS

Introduction to HTML5

Chapter 13 HTML5 Functions

HTML5. HTML5 Introduction. Form Input Types. Semantic Elements. Form Attributes. Form Elements. Month Number Range Search Tel Url Time Week

Fundamentals of Website Development

Revision for Grade 7 ASP in Unit :1&2 Design & Technology Subject

HTML5, CSS3, JQUERY SYLLABUS

Multimedia im Netz Online Multimedia Winter semester 2015/16

Chapter 1. Introducing HTML5. Objectives: Learn what HTML5 is about. Discover what HTML5 really is

TAMZ I. (Design of Applications for Mobile Devices I) Lecture 7 Timers HTML5 APIs

HTML 5: Fact and Fiction Nathaniel T. Schutta

HTML5 and Mobile: New Markup & Styles for the Mobile Web. Jason Clark Head of Digital Access & Web Services Montana State University Libraries

Web System and Technologies (Objective + Subjective)

PHP,HTML5, CSS3, JQUERY SYLLABUS

QUICK REFERENCE GUIDE

Programmazione Web a.a. 2017/2018 HTML5

Development of Web Applications

HTML CS 4640 Programming Languages for Web Applications

HTML 5 Part I Introduction, structure and semantics

Flash, Video. How to add Flash movies into your site How to add video and audio to your site HTML5 <video> and <audio> elements

CPET 499/ITC 250 Web Systems. Topics

Advanced Web Programming C2. Basic Web Technologies

GRAPHIC WEB DESIGNER PROGRAM

Introduction to HTML5: Part 2

Static Webpage Development

IGME-330. Rich Media Web Application Development I Week 1

LECTURE 3. Web-Technology

HTML5 An Introduction

Index LICENSED PRODUCT NOT FOR RESALE

WA1925 Enterprise Web Development using HTML5 EVALUATION ONLY

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

HTML5 HTML & Fut ure o Web M edi dia Streami a est Work h op, ov 2010 Michael Dale Zohar Babin eve oper o Dev R l e t a i tions & C

Sections and Articles

/

Qiufeng Zhu Advanced User Interface Spring 2017

Web development using PHP & MySQL with HTML5, CSS, JavaScript

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 1

CIS 408 Internet Computing Sunnie Chung

Webgurukul Web Designing Course

HTML5 are we there yet? Design for web content

Certified HTML5 Developer VS-1029

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 11 Test Bank

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

Standards in Flux Norman Walsh MarkLogic Corporation 14 Feb 2011

Web Site Design and Development Lecture 23. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

Mobile MOUSe WEB SITE DESIGN ONLINE COURSE OUTLINE

IDM 221. Web Design I. IDM 221: Web Authoring I 1

Designing Reusable Web Components

Learn HTML5 in 5 Minutes!

B. V. Patel Institute of Business Management, Computer and Information Technology, UTU. B. C. A (3 rd Semester) Teaching Schedule

HTML5 for Java Developers. Sang Shin Founder and Chief Instructor JPassion.com

CSCU9B2 Practical 8: Location-Aware Web Pages NOT USED (DOES NOT ALL WORK AS ADVERTISED)

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

HTML5. 10 Things to Know. Webster University. ! R. Scott Granneman

Introduction to HTML 5. Brad Neuberg Developer Programs, Google

HTML5 a clear & present danger

HTML. HTML Evolution

Technologies Web Côté client

Experimental Features on Kindle (2nd Generation)

Bridges To Computing

Web Designing Course

Client-side Techniques. Client-side Techniques HTML/XHTML. Static web pages, Interactive web page: without depending on interaction with a server

CompuScholar, Inc. Alignment to Utah's Web Development I Standards

Part I. Web Technologies for Interactive Multimedia

1.7 Uniform Resource Identifiers and Domain Names 13 URIs and URLs 13 Domain Names 13

CSS for Page Layout Robert K. Moniot 1

Accessibility of EPiServer s Sample Templates

ID1354 Internet Applications

Lesson 5: Multimedia on the Web

Chapter 3 HTML Multimedia and Inputs

HTML avanzato e HTML5 (per cominciare)

AGENDA :: MULTIMEDIA TOOLS :: CLASS NOTES

Next... Next... Handling the past What s next - standards and browsers What s next - applications and technology

Transcription:

What is HTML5? HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML came in 1999. The web has changed a lot since then. HTML5 is still a work in progress. However, most modern browsers have some HTML5 support. How Did HTML5 Get Started? HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG). WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. In 2006, they decided to cooperate and create a new version of HTML. Some rules for HTML5 were established: New features should be based on HTML, CSS, DOM, and JavaScript Reduce the need for external plugins (like Flash) Better error handling More markup to replace scripting HTML5 should be device independent The development process should be visible to the public New Features Some of the most interesting new features in HTML5: The canvas element for drawing The video and audio elements for media playback Better support for local offline storage New content specific elements, like article, footer, header, nav, section New form controls, like calendar, date, time, email, url, search Browser Support HTML5 is not yet an official standard, and no browsers have full HTML5 support. But all major browsers (Safari, Chrome, Firefox, Opera, Internet Explorer) continue to add new HTML5 features to their latest versions. HTML 5 by M. Qasim Nadeem. Page 1

What is Canvas? The HTML5 canvas element uses JavaScript to draw graphics on a web page. A canvas is a rectangular area, and you control every pixel of it. The canvas element has several methods for drawing paths, boxes, circles, characters, and adding images. Create a Canvas Element Add a canvas element to the HTML5 page. Specify the id, width, and height of the element: <canvas id="mycanvas" width="200" height="100"></canvas> The canvas element has no drawing abilities of its own. All drawing must be done inside a JavaScript: Gradient: <!DOCTYPE html> <html> <body> <canvas id="mycanvas" width="200" height="100" style="border:1px solid #c3c3c3;"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var c=document.getelementbyid("mycanvas"); var cxt=c.getcontext("2d"); var grd=cxt.createlineargradient(0,0,175,50); grd.addcolorstop(0,"#ff0000"); grd.addcolorstop(1,"#00ff00"); cxt.fillstyle=grd; cxt.fillrect(0,0,175,50); </body> </html> Line: <!DOCTYPE html> <html> <body> <canvas id="mycanvas" width="200" height="100" style="border:1px solid #c3c3c3;"> Your browser does not support the canvas element. </canvas> HTML 5 by M. Qasim Nadeem. Page 2

<script type="text/javascript"> var c=document.getelementbyid("mycanvas"); var cxt=c.getcontext("2d"); cxt.moveto(10,10); cxt.lineto(150,50); cxt.lineto(10,50); cxt.stroke(); </body> </html> Storing Data on the Client HTML5 offers two new objects for storing data on the client: localstorage - stores data with no time limit sessionstorage - stores data for one session Earlier, this was done with cookies. Cookies are not suitable for large amounts of data, because they are passed on by EVERY request to the server, making it very slow and in-effective. In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the website's performance. The data is stored in different areas for different websites, and a website can only access data stored by itself. The localstorage Object The localstorage object stores the data with no time limit. The data will be available the next day, week, or year. How to create and access a localstorage: <script type="text/javascript"> localstorage.lastname="smith"; document.write(localstorage.lastname); The following example counts the number of times a user has visited a page: <script type="text/javascript"> if (localstorage.pagecount) localstorage.pagecount=number(localstorage.pagecount) +1; else localstorage.pagecount=1; HTML 5 by M. Qasim Nadeem. Page 3

document.write("visits "+ localstorage.pagecount + " time(s)."); The sessionstorage Object The sessionstorage object stores the data for one session. The data is deleted when the user closes the browser window. How to create and access a sessionstorage: <script type="text/javascript"> sessionstorage.lastname="smith"; document.write(sessionstorage.lastname); The following example counts the number of times a user has visited a page, in the current session: <script type="text/javascript"> if (sessionstorage.pagecount) sessionstorage.pagecount=number(sessionstorage.pagecount) +1; else sessionstorage.pagecount=1; document.write("visits "+sessionstorage.pagecount+" time(s) this session."); Video on the Web Until now, there has never been a standard for showing video on a web page. Today, most videos are shown through a plugin (like flash). However, not all browsers have the same plugins. HTML5 specifies a standard way to include video, with the video element. Video Formats Currently, there are 3 supported video formats for the video element: Format IE Firefox Opera Chrome Safari Ogg No 3.5+ 10.5+ 5.0+ No MPEG 4 9.0+ No No 5.0+ 3.0+ WebM No 4.0+ 10.6+ 6.0+ No HTML 5 by M. Qasim Nadeem. Page 4

Ogg = Ogg files with Theora video codec and Vorbis audio codec MPEG4 = MPEG 4 files with H.264 video codec and AAC audio codec WebM = WebM files with VP8 video codec and Vorbis audio codec The control attribute is for adding controls: play, pause, and volume. It is also a good idea to always include width and height attributes. You should also insert text content between the <video> and </video> tags for browsers that do not support the video element: <video src="movie.ogg" width="320" height="240" controls="controls"> Your browser does not support the video tag. </video> The example above uses an Ogg file, and will work in Firefox, Opera and Chrome. To play the video in Internet Explorer, Safari and Chrome, we must add an MPEG4 file. The <video> element allows multiple <source> elements. <source> elements can link to different video files. The browser will use the first recognized format: <video width="320" height="240" controls="controls"> <source src="movie.mp4" type="video/mp4" /> <source src="movie.ogg" type="video/ogg" /> Your browser does not support the video tag. </video> Audio on the Web Until now, there has never been a standard for playing audio on a web page. Today, most audio are played through a plugin (like flash). However, not all browsers have the same plugins. HTML5 specifies a standard way to include audio, with the audio element. The audio element can play sound files, or an audio stream. Audio Formats Currently, there are 3 main formats for the audio element: Format IE 9 Firefox 3.5 Opera 10.5 Chrome 3.0 Safari 3.0 Ogg Vorbis No Yes Yes Yes No MP3 Yes No No Yes Yes HTML 5 by M. Qasim Nadeem. Page 5

Wav No Yes Yes Yes Yes To play an audio file in HTML5, this is all you need: <audio src="song.ogg" controls="controls"> Your browser does not support the audio element. </audio> <audio controls="controls"> <source src="song.ogg" type="audio/ogg" /> <source src="song.mp3" type="audio/mpeg" /> Your browser does not support the audio element. </audio> HTML5 New Input Types HTML5 has several new input types for forms. These new features allow for better input control and validation. This chapter covers the new input types: email url number range Date pickers (date, month, week, time, datetime, datetime-local) search color Browser Support Input type IE Firefox Opera Chrome Safari email No 4.0 9.0 10.0 No url No 4.0 9.0 10.0 No number No No 9.0 7.0 5.1 range No No 9.0 4.0 4.0 Date pickers No No 9.0 10.0 5.1 search No 4.0 11.0 10.0 No color No No 11.0 12 No Note: Opera has the best support for the new input types. However, you can already start using them in all major browsers. If they are not supported, they will behave as regular text fields. HTML 5 by M. Qasim Nadeem. Page 6

Input Type - email The email type is used for input fields that should contain an e-mail address. The value of the email field is automatically validated when the form is submitted. E-mail: <input type="email" name="user_email" /> Tip: Safari on the iphone recognizes the email input type, and changes the on-screen keyboard to match it (adds @ and.com options). Input Type - url The url type is used for input fields that should contain a URL address. The value of the url field is automatically validated when the form is submitted. Homepage: <input type="url" name="user_url" /> Safari on the iphone recognizes the url input type, and changes the on-screen keyboard to match it (adds.com option). Input Type - number The number type is used for input fields that should contain a numeric value. You can also set restrictions on what numbers are accepted: Points: <input type="number" name="points" min="1" max="10" /> Use the following attributes to specify restrictions for the number type: Attribute Value Description max number Specifies the maximum value allowed min number Specifies the minimum value allowed step number Specifies legal number intervals (if step="3", legal numbers could be -3,0,3,6, etc) value number Specifies the default value Input Type - range The range type is used for input fields that should contain a value from a range of numbers. The range type is displayed as a slider bar. You can also set restrictions on what numbers are accepted: <input type="range" name="points" min="1" max="10" /> HTML 5 by M. Qasim Nadeem. Page 7

Use the following attributes to specify restrictions for the range type: Attribute Value Description max number Specifies the maximum value allowed min number Specifies the minimum value allowed step number Specifies legal number intervals (if step="3", legal numbers could be -3,0,3,6, etc) value number Specifies the default value Input Type - Date Pickers HTML5 has several new input types for selecting date and time: date - Selects date, month and year month - Selects month and year week - Selects week and year time - Selects time (hour and minute) datetime - Selects time, date, month and year (UTC time) datetime-local - Selects time, date, month and year (local time) The following example allows you to select a date from a calendar: Date: <input type="date" name="user_date" /> Input type "month": Input type "week": Input type "time": Input type "datetime": Input type "datetime-local": Input Type - search The search type is used for search fields, like a site search, or Google search. The search field behaves like a regular text field. Input Type - color The color type is used for input fields that should contain a color. The Opera browser will allow you to select a color from a color picker, Google's Chrome will only allow hexadecimal color values to be submitted: Color: <input type="color" name="user_color" /> HTML 5 by M. Qasim Nadeem. Page 8

list Attribute The list attribute specifies a datalist for an input field. A datalist is a list of options for an input field. Note: The list attribute works with the following <input> types: text, search, url, telephone, email, date pickers, number, range, and color. Webpage: <input type="url" list="url_list" name="link" /> <datalist id="url_list"> <option label="w3schools" value="http://www.w3schools.com" /> <option label="google" value="http://www.google.com" /> <option label="microsoft" value="http://www.microsoft.com" /> </datalist> New Elements in HTML5 The internet has changed a lot since HTML 4.01 became a standard in 1999. Today, some elements in HTML 4.01 are obsolete, never used, or not used the way they were intended to. These elements are deleted or re-written in HTML5. To better handle today's internet use, HTML5 also includes new elements for better structure, drawing, media content, and better form handling. New Markup Elements New elements for better structure: Tag Description <article> Specifies independent, self-contained content, could be a news-article, blog post, forum post, or other articles which can be distributed independently from the rest of the site. <aside> For content aside from the content it is placed in. The aside content should be related to the surrounding content <command> A button, or a radiobutton, or a checkbox <details> For describing details about a document, or parts of a document <summary> A caption, or summary, inside the details element <figure> For grouping a section of stand-alone content, could be a video <figcaption> The caption of the figure section <footer> For a footer of a document or section, could include the name of the author, the date of the document, contact information, or copyright information HTML 5 by M. Qasim Nadeem. Page 9

<header> For an introduction of a document or section, could include navigation <hgroup> For a section of headings, using <h1> to <h6>, where the largest is the main heading of the section, and the others are sub-headings <mark> For text that should be highlighted <meter> For a measurement, used only if the maximum and minimum values are known <nav> For a section of navigation <progress> The state of a work in progress <ruby> For ruby annotation (Chinese notes or characters) <rt> For explanation of the ruby annotation <rp> What to show browsers that do not support the ruby element <section> For a section in a document. Such as chapters, headers, footers, or any other sections of the document <time> For defining a time or a date, or both <wbr> Word break. For defining a line-break opportunity. New Media Elements HTML5 provides a new standard for media content: Tag Description <audio> For multimedia content, sounds, music or other audio streams <video> For video content, such as a movie clip or other video streams <source> For media resources for media elements, defined inside video or audio elements <embed> For embedded content, such as a plug-in The Canvas Element The canvas element uses JavaScript to make drawings on a web page. HTML 5 by M. Qasim Nadeem. Page 10

Tag Description <canvas> For making graphics with a script New Form Elements HTML5 offers more form elements, with more functionality: Tag Description <datalist> A list of options for input values <keygen> Generate keys to authenticate users <output> For different types of output, such as output written by a script New Input Type Attribute Values Also, the input element's type attribute has many new values, for better input control before sending it to the server: Type Description tel The input value is of type telephone number search The input field is a search field url The input value is a URL email The input value is one or more email addresses datetime The input value is a date and/or time date The input value is a date month The input value is a month week The input value is a week time The input value is of type time datetime-local The input value is a local date/time number The input value is a number range The input value is a number in a given range HTML 5 by M. Qasim Nadeem. Page 11

color The input value is a hexadecimal color, like #FF8800 placeholder Specifies a short hint that describes the expected value of an input field HTML5 - Using Geolocation Use the getcurrentposition() method to get the user's position. The example below is a simple Geolocation example returning the latitude and longitude of the user's position <!DOCTYPE html> <html> <body> <p id="demo">click the button to get your coordinates:</p> <button onclick="getlocation()">try It</button> <script> var x=document.getelementbyid("demo"); function getlocation() if (navigator.geolocation) navigator.geolocation.getcurrentposition(showposition); elsex.innerhtml="geolocation is not supported by this browser."; function showposition(position) x.innerhtml="latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude; HTML 5 by M. Qasim Nadeem. Page 12

</body> </html> Drag and Drop Drag and drop is a very common feature. It is when you "grab" an object and drag it to a different location. In HTML5, drag and drop is part of the standard, and any element can be draggable. <!DOCTYPE HTML> <html> <head> <style type="text/css"> #div1 width:350px;height:70px;padding:10px;border:1px solid #aaaaaa; </style> <script> function allowdrop(ev) ev.preventdefault(); function drag(ev) ev.datatransfer.setdata("text",ev.target.id); function drop(ev) HTML 5 by M. Qasim Nadeem. Page 13

ev.preventdefault(); var data=ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); </head> <body> <p>drag the W3Schools image into the rectangle:</p> <div id="div1" ondrop="drop(event)" ondragover="allowdrop(event)"></div> <br> <img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)" width="336" height="69"> </body> </html> HTML 5 by M. Qasim Nadeem. Page 14