Here we will discuss the basics of HTML5 document. Today HTML5 is one of the most exciting buzz in web circles. Actaully HTML5 is the new standard for HTML.
it is still a work in progress. However, the major browsers support many of the new HTML5 elements and APIs but not all.
Rules for HTML5:
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
The HTML5 <!DOCTYPE>:
In HTML5 there is only one <!DOCTYPE> declaration:
HTML5 required tags:
There is This is a HTML5 document with required tags:
<title>Here Title of the document</title>
Here The content of the document……
HTML5 – New Features:
HTML5 has few very exciting and interesting features. below is the few major features are given…
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
Browser Support for HTML5
HTML5 is not officialy accepted by all browsers as it is not official standard for all brpwsers.
But all major browsers like (Safari, Chrome, Firefox, Opera, Internet Explorer) continue to add new HTML5 features to their latest versions.
Q 1- What is the difference between HTML and HTML5 ?
Ans: HTML5 is nothing more then upgraded version of HTML where in HTML5 Lot of new future like Video, Audio/mp3, date select function , placeholder , Canvas, 2D/3D Graphics, Local SQL Database added so that no need to do external plugin like Flash player or other library
Q 2- What is the <!DOCTYPE> ? Is it necessary to use in HTML5 ?
Ans: The <!DOCTYPE> is an instruction to the web browser about what version of HTML the page is written in. AND The <!DOCTYPE> tag does not have an end tag and It is not case sensitive.
The <!DOCTYPE> declaration must be the very first thing in HTML5 document, before the <html> tag. As In HTML 4.01, all <! DOCTYPE > declarations require a reference to a Document Type Definition (DTD), because HTML 4.01 was based on Standard Generalized Markup Language (SGML). WHERE AS HTML5 is not based on SGML, and therefore does not require a reference to a Document Type Definition (DTD).
Q 3- How many New Markup Elements you know in HTML5
Ans: Below are the New Markup Elements added in HTML5
<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
<bdi> For text that should not be bound to the text-direction of its parent elements
<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
<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.
Q 4- What are the New Media Elements in HTML5? is canvas element used in HTML5
Ans: Below are the New Media Elements have added in HTML5
<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
<embed> For embedded content, such as a plug-in
<track> For text tracks used in mediaplayers
yes we can use Canvas element in html5 like <canvas></canvas>
Q 5- Do you know New Input Type Attribute in HTML5
Ans: Yes we can use below new input type Attribute in HTML5
tel The input is of type telephone number
search The input field is a search field
url a URL
email One or more email addresses
datetime A date and/or time
date A date
month A month
week A week
time The input value is of type time
datetime-local A local date/time
number A number
range A number in a given range
color A hexadecimal color, like #82345c
placeholder Specifies a short hint that describes the expected value of an input field
Q 6- How to add video and audio in HTML5
Like below we can add video in html5
<video width=“320? height=“240? controls=“controls”>
<source src=“mysong.mp4? type=“video/mp4? />
<source src=“mysong.ogg” type=“video/ogg” />
And audio like this
<source src=“mysong.ogg” type=“audio/ogg” />
<source src=“mysong.mp3? type=“audio/mpeg” />
Q 7- What is the use of localStorage in HTML5?
Ans: Before HTML5 LocalStores was done with cookies. Cookies are not very good for large amounts of data, because they are passed on by every request to the server, so it was 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.and The data is stored in different areas for different websites, and a website can only access data stored by itself.
And for creating localstores just need to call localStorage object like below we are storing name and address
Q 8- What is the sessionStorage Object in html5 ? How to create and access?
Ans: The sessionStorage object stores the data for one session. The data is deleted when the user closes the browser window. like below we can create and access a sessionStorage here we created “name” as session
Q 9- What the use of Canvas Element in HTML5?
<canvas id=“smartCanvas” width=“500? height=“400?>
Q 10- What purpose does HTML5 serve?
Ans: HTML5 is the proposed next standard for HTML 4.01, XHTML 1.0 and DOM Level 2 HTML. It aims to reduce the need for proprietary plug-in-based rich internet application (RIA) technologies such as Adobe Flash, Microsoft Silverlight, Apache Pivot, and Sun JavaFX.
Q 11- What is the difference between HTMl5 Application cache and regular HTML browser cache?
Q 12- HOW DO YOU PLAY A AUDIO USING HTML5?
We can display audio using the tag as shown below:
<source src=“test.mp3? type=“audio/mp3? />
Q 13- WHAT ARE THE DIFFERENT TYPES OF STORAGE IN HTML5?
HTML5 offers two new objects for storing data on the client:
LocalStorage – stores data with no time limit
SessionStorage – stores data for one session.The data is deleted when the user closes the browser window.
Q 14- HOW DO YOU PLAY A VIDEO USING HTML5?
We can display video using the tag as shown below:
<video width=“320? height=“240? controls=“controls”>
<source src=“test.mp4? type=“video/mp4? />
Q 15- WHAT ARE THE NEW APIS PROVIDED BY THE HTML 5 STANDARD? GIVE A BRIEF DESCRIPTION OF EACH?
Timed media playback
Offline storage database
Browser history management
MIME type and protocol handler registration
Q 16- WHAT OTHER ADVANTAGES DOES HTML5 HAVE?
a) Cleaner markup
b) Additional semantics of new elements like <header>, <nav>, and <time>
c) New form input types and attributes that will (and in Opera’s case, do) take the hassle out of scripting forms.
Q 17- GIVE AN EXAMPLE OF NEW ELEMENTS IN HTML5 TO SUPPORT MULTIMEDIA AND GRAPHICS?
Ans: HTML5 introduced many elements such as , instead of to support multimedia.
Q 18- WHAT IS HTML5?
Ans: HTML5 is the latest version of HTML standard supporting multimedia and graphical content.
Q 19- WHAT IS THE DIFFERENCE BETWEEN HTML5 APPLICATION CACHE AND REGULATE HTML BROWSER CACHE?
Q 20- WHAT PURPOSE DOES HTML5 SERVE?
HTML5 is the proposed next standard for HTML 4.01, XHTML 1.0 and DOM Level 2 HTML. It aims to reduce the need for proprietary plug-in-based rich internet application (RIA) technologies such as Adobe Flash, Microsoft Silver light, Apache Pivot, and Sun JavaFX.
Q 21 – WHAT IS THE STATUS OF THE DEVELOPMENT OF THE HTML 5 STANDARD?
Ans: HTML5 is being developed as the next major revision of HTML (HyperText Markup Language), the core markup language of the World Wide Web. The Web Hypertext Application Technology Working Group (WHATWG) started work on the specification in June 2004 under the name Web Applications 1.0. As of March 2010[update], the specification is in the Draft Standard state at the WHATWG, and in Working Draft state at the W3C.