3 HTML 28 05 2024
3 HTML 28 05 2024
Agenda
History, Vision & Future of HTML5
Getting Started With HTML5
Structure of a Web Page
Forms
Audio and Video
1. History, Vision & Future of HTML5
1.1 What Is HTML5?
• December 1999 - January 2000: ECMAScript 3rd Edition, XHTML 1.0 (Basically
HTML tags
reformulated in XML) and, HTML 4.01 recommendations are published
• The key to understanding HTML5 is that it is not one, but a group of technologies.
Within HTML5, developers have a tremendous amount of choice regarding what they
use and what they don’t use
• The power of HTML5 being ready for prime-time can be seen in Microsoft’s choice to
utilize it in Windows 8
HTML5 also update some of the previous existing elements to better reflect how they are used on
the Web or to make them more useful such as:
• The <a> element can now also contain flow content instead of just phrasing content
• The <hr> element is now representing a paragraph-level thematic break
• The <cite> element only represent the title of a work
• The <strong> element is now representing importance rather than strong emphasis
3. Structure of Web page
3.2. First HTML5 webpage
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
That’s all I need to create my first HTML5 page
</body>
</html>
<nav> does not have to be used in every place you can find links.
For instance, footers often contains links to terms of service, copyright page and such,
However, we mustn't think that "header" is only for masthead of a website. "header" can be use as a
heading of an blog entry or news article as every article has its title and published date and time
3. Structure of Web page
We should use article for content that we think it can be distributable. Just like news or blog entry
can we can share in RSS feed
article. In fact, it is very common to have header as each article should have a title.
3. Structure of Web page
Please don't think you can only have one footer per web document, you can have a footer in every
The progress can be either determinate OR interderminate. Which means, you can use "progress"
element to indicate a progress that you do not even know how much more work is to be done yet.
One example is score of rating. I would rate this movie <meter min="0" max="10" value="8">8 of
10</meter>.
3. Structure of Web page
Basically, it is used to bring the reader's attention to a part of the text that might not have been
3. Structure of Web page
While the content of the <figure> element is related to the main flow, its position is independent
of the main flow, and if removed it should not affect the flow of the document
3. Structure of Web page
3.3. Lets put altogether
3. Structure of Web page
3.3. Designing blog with html5
IE layout
There’s one gotcha about styling HTML 5 pages in IE: it doesn’t work.
You can force it to quite easily with a JavaScript hack
document.createElement('element name').
HTML 5 enabling script which I use in the header to conjure all the missing elements into existence
all at once.
3. Structure of Web page
3.3. why so much fuss for semantics in html5
Well, they add semantics to the page. The browser now knows which area of your site is the header or
the footer because there are header and footer elements, whereas div might be called “branding
The first is for search engine use; it’s easy to imagine Messrs Google or Yahoo! giving lower weighting
to content in footer elements, or extra weight to content in the header.
site navigable for people with disabilities. People with learning difficulties might instruct their
browser always to put the articles before the navigation
HTML 5 Forms
4. Forms
4.1. Introduction
HTML5 web forms have introduced new form elements, input types, attributes, and
other features. Many of these features we’ve been using in our interfaces for years:
form validation, combo boxes, placeholder text, and the like. The difference is that
where before we had to resort to JavaScript to create these behaviors, they’re now
available directly in the browser; all you need to do is set an attribute in your markup
to make them available.
4. Forms
4.1. Introduction
HTML5 web forms have introduced new form elements, input types, attributes, and
other features. Many of these features we’ve been using in our interfaces for years:
form validation, combo boxes, placeholder text, and the like. The difference is that
where before we had to resort to JavaScript to create these behaviors, they’re now
available directly in the browser; all you need to do is set an attribute in your markup
to make them available.
HTML5 not only makes marking up forms easier on the developer, it’s also better
for the user. With client-side validation being handled natively by the browser,
there will be greater consistency across different sites, and many pages will load
faster without all that redundant JavaScript.
The autocomplete attribute specifies whether a form or input field should have autocomplete on or off.
When autocomplete is on, the browser automatically complete values based on values that the user has
entered before.
Example: ../forms/autocomplete.html
4. Forms
4.1. form attributes
Example: ../forms/noValidate.html
4. Forms
4.2. input attributes
Example: ../forms/autofocus.html
4. Forms
4.2. input attributes
• The formaction attribute specifies the URL of a file that will process the input control when the
form is submitted.
• The formaction attribute overrides the action attribute of the <form> element.
• Note: The formaction attribute is used with type="submit" and type="image"
Example: ../forms/formaction.html
4. Forms
4.2. input attributes
• The formmethod attribute defines the HTTP method for sending form-data to the action URL.
• The formmethod attribute overrides the method attribute of the <form> element.
• Note: The formmethod attribute can be used with type="submit" and type="image".
Example: ../forms/formmethod.html
4. Forms
4.2. input attributes
Example: ../forms/formnovalidate.html
4. Forms
4.2. input attributes
Example: ../forms/formtarget.html
4. Forms
4.2. input attributes
• Datalists are currently only supported in Firefox and Opera, but they are very cool.
• They fulfill a common requirement: a text field with a set of predefined autocomplete
• options.
Example: ../forms/datalist.html
4. Forms
4.2. input attributes
The Boolean required attribute tells the browser to only submit the form if the field
in question is filled out correctly. Obviously, this means that the field can’t be left
empty, but it also means that, depending on other attributes or the field’s type, only
certain types of values will be accepted.
If a required field is empty or invalid, the form will fail to submit, and focus will
move to the first invalid form element.
The required attribute can be set on any input type except button, range, color,
and hidden, all of which generally have a default value.
• Example: ../forms/required.html
4. Forms
4.2. input attributes
The placeholder attribute allows a short hint to be displayed inside the form element,
space permitting, telling the user what data should be entered in that field.
The placeholder text disappears when the field gains focus, and reappears on blur
if no data was entered.
• Example: ../forms/placeholder.html
4. Forms
4.2. input attributes
The multiple attribute, if present, indicates that multiple values can be entered in
a form control. While it has been available in previous versions of HTML, it only applied to the select
element. In HTML5, it can be added to email and file input types as well.
If present, the user can select more than one file, or include several comma-separated email addresses.
At the time of writing, multiple file input is only supported in Chrome, Opera, and
Firefox.
Introduction
you’re familiar with: checkbox, text, password, and submit. Here’s the full list of types that were
available before HTML5:
■ button ■ checkbox ■ file ■ hidden ■ image ■ password ■ radio ■ reset ■ submit ■ text
HTML5 gives us input types that provide for more data-specific UI elements and
native data validation. HTML5 has a total of 13 new input types:
■ search
■ email
■ url
■ tel
■ datetime
■ date
■ month
■ week
■ time
■ datetime-local
■ number
■ range
■ color
4. Forms
4.3. input types
The email type (type="email") is, unsurprisingly, used for specifying one or more email addresses.
It supports the Boolean multiple attribute, allowing for multiple, comma-separated email addresses.
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.
For telephone numbers, use the tel input type (type="tel"). Unlike the url and email types,
the tel type doesn’t enforce a particular syntax or pattern. Letters and numbers—indeed, any
characters other than new lines or carriage returns—are valid.
The range input type (type="range") displays a slider control in browsers that
support it (currently Opera and WebKit). As with the number type, it allows the
min, max, and step attributes.
Define a control for entering a number whose exact value is not important
The color input type (type="color") provides the user with a color picker
Supported only in Opera
<audio>
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.
Example: ../audioVideo/audio.html
5. Audio & video
4.3. new html5 element
To be safe, we need to add the fallback to a Flash audio player, in case the browser doesn't support any
of the formats we specified. For instance, Firefox 3.5 only supports the audio tag with Ogg format, but
we might only have the mp3 file available
5. Audio & video
4.3. new html5 element
<video>
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.
5. Audio & video
4.3. new html5 element
<video attributes>