Html5

32
Web Programming

description

Basic of HTML5

Transcript of Html5

Page 1: Html5

Web Programming

Page 2: Html5

2

HTML5

HTML5 Intro HTML5 input type HTML5 Video HTML5 Audio

Page 3: Html5

3

What is HTML5?• HTML5 will be the new standard for HTML.• The previous version of HTML, HTML 4.01, came in 1999. The internet has changed

significantly since then.• HTML5 is intended to subsume not only HTML 4, but also XHTML 1 and DOM Level 2 HTML.• HTML5 is designed to deliver almost everything you want to do online without requiring

additional plugins. It does everything from animation to apps, music to movies, and can also be used to build complicated applications that run in your browser.

• HTML5 is also cross-platform (it does not care whether you are using a tablet or a smartphone, a netbook, notebook or a Smart TV).

• HTML5 can also be used to write web applications that still work when you are not online.• The HTML 5 working group includes AOL, Apple, Google, IBM, Microsoft, Mozilla, Nokia,

Opera, and hundreds of other vendors.• HTML5 is still a work in progress. However, all major browsers support many of the new

HTML5 elements and APIs.

Page 4: Html5

4

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 The need for external plugins (like Flash) needs to be reduced Error handling should be easier than in previous versions Scripting has to be replaced by more markup HTML5 should be device-independent The development process should be visible to the public

Page 5: Html5

5

HTML5 is The New HTML Standard

• New Elements• New Attributes• Full CSS3 Support• Video and Audio• 2D/3D Graphics• Local Storage• Local SQL Database• Web Applications

Page 6: Html5

6

The HTML5 <!DOCTYPE>

In HTML5 there is only one <!doctype> declaration, and it is very simple: <!DOCTYPE html>

Page 7: Html5

7

HTML5 - New Features

Some of the most interesting new features in HTML5: The <canvas> element for 2D drawing The <video> and <audio> elements for media playback Support for local storage New content-specific elements, like <article>, <footer>, <header>,

<nav>, <section> New form controls, like calendar, date, time, email, url, search

Page 8: Html5

8

Browser Support for HTML5

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.

Page 9: Html5

9

HTML5 New Elements

• The internet, and the use of the internet, has changed a lot since HTML 4.01 became a standard in 1999.• Today, several elements in HTML 4.01 are obsolete, never used, or not

used the way they were intended. All those elements are removed or re-written in HTML5.• To better handle today's internet use, HTML5 also includes new

elements for drawing graphics, adding media content, better page structure, better form handling, and several APIs to drag/drop elements, find Geolocation, include web storage, application cache, web workers, etc.

Page 10: Html5

10

Removed Elements

The following HTML 4.01 elements are removed from HTML5:• <applet>• <big>• <center>• <font>• <frame>• <frameset>• <noframes>• <strike>• <tt>

Page 11: Html5

11

HTML5 New Elements

<canvas> Used to draw graphics, on the fly, via scripting (usually JavaScript)

<audio> Defines sound content

<video> Defines a video or movie

<source> Defines multiple media resources for <video> and <audio>

<embed> Defines a container for an external application or interactive content (a plug-in)

<keygen> Defines a key-pair generator field (for forms)

Page 12: Html5

12

HTML5 Input TypesHTML5 has several new input types for forms. These new features allow better input control and validation. color date datetime datetime-local email month number range search tel time url week

<input type=“ typeOfControl” name=“anyName” >

Page 13: Html5

13

Input Type: color

• The color type is used for input fields that should contain a color.<!DOCTYPE html> <html> <body> <form action="demo_form.php"> Select your favorite color: <input type="color" name="favcolor"><br> <input type="submit"> </form> </body> </html>

Page 14: Html5

14

Input Type: date

• The date type allows the user to select a date.<html> <body> <form action="demo_form.php"> Date: <input type="date" name="bday"> <input type="submit"> </form></body></html>

Pervious practice for mentioning date

Page 15: Html5

15

Input Type: datetime

The datetime type allows the user to select a date and time (with time zone).<html> <body> <form action="demo_form.php"> Date Time: <input type="datetime" name="bday"> <input type="submit"> </form></body></html>

Page 16: Html5

16

Input Type: datetime-local

The datetime-local type allows the user to select a date and time (no time zone).<html><body>

<form action="demo_form.php"> Birthday: <input type="datetime-local" name="dateTime"> <input type="submit"></form>

</body></html>

Page 17: Html5

17

Input Type: email

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

<html><body>

<form action="demo_form.php"> E-mail: <input type=“email" name=“email"> <input type="submit"></form>

</body></html>

Page 18: Html5

18

Input Type: month

• The month type allows the user to select a month and year.<html><body>

<form action="demo_form.php"> Birthday: <input type=“month" name=“month"> <input type="submit"></form>

</body></html>

Page 19: Html5

19

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:<form action="demo_form.php"> Quantity (between 1 and 5): <input type="number" name="quantity" min="1" max="5"> <input type="submit"></form>

Page 20: Html5

20

Input Type: number Cont…

Use the following attributes to specify restrictions:• max - specifies the maximum value allowed• min - specifies the minimum value allowed• step - specifies the legal number intervals• value - Specifies the default value<input type="number" name="quantity" min="0" max="10" step="2" value="2">

Page 21: Html5

21

Input Type: range

The range type is used for input fields that should contain a value from a range of numbers.• You can also set restrictions on what numbers are accepted.<form action="demo_form.php"> Points: 0<input type="range" name="points" min="1" max="10">10<input type="submit"></form>

Page 22: Html5

22

Input Type: time

• The time type allows the user to select a time.

<form action="demo_form.asp"> Select a time: <input type="time" name="usr_time"><input type="submit"></form>

Page 23: Html5

23

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.<form action="demo_form.asp"> Add your homepage: <input type="url" name="homepage"><br> <input type="submit"></form>

Page 24: Html5

24

Input Type: week

• The week type allows the user to select a week and year.<form action="demo_form.asp"> Select a week: <input type="week" name="year_week"> <input type="submit"></form>

Page 25: Html5

25

HTML5 Video

Video on the Web• Until now, there has not been a standard for showing a video/movie

on a web page.• Today, most videos are shown through a plug-in (like flash). However,

different browsers may have different plug-ins.• HTML5 defines a new element which specifies a standard way to

embed a video/movie on a web page: the <video> element.

Page 26: Html5

26

HTML5 Video

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

Page 27: Html5

27

HTML5 Video

Page 28: Html5

28

HTML5 Audio

• HTML5 provides a standard for playing audio files.• Until now, there has not been a standard for playing audio files on a

web page.• Today, most audio files are played through a plug-in (like flash).

However, different browsers may have different plug-ins.• HTML5 defines a new element which specifies a standard way to

embed an audio file on a web page: the <audio> element.

Page 29: Html5

29

HTML5 Audio

• <audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio tag.</audio>

Page 30: Html5

30

HTML5 Audio

Page 31: Html5

31

Assignment

1. What is W3C and WHATWG? What are their Job responsibilities ?2. Create a Sing-up web page which consist following Fields

1. User Name2. ID 3. Password 4. Gender5. Date of Birth

3. Create Sign in Web page.4. Create a Web page which deals with video5. Create a web page which deals with Audio

Page 32: Html5

32

References

• http://www.w3schools.com/tags/ref_html_dtd.asp