Sunday, September 29, 2013

HTML 5 Interview questions for beginners



HTML5.0 Basic

What is HTML5?

HTML5 is the latest revision of the HTML standard. It is a language for structuring and presenting content for the World Wide Web, a core technology of the Internet.
WHATWG (Web Hypertext Application Technology Working Group) a new group of W3C members felt that W3C is not paying enough attention to the real-world development needs of language, it has started working on new specification of HTML-HTML5. Hence HTML5 is a new version of HTML 4.01 and XHTML 1.0 focusing on the needs of Web application developers as well as addressing issues found in the current specifications.
In particular, HTML5 adds many new syntactical features. New elements, such as <section>, <article>, <header>, and <nav>, are the basic parts of semantic content of documents. These also include the <video>, <audio>, and <canvas> elements, as well as the integration of SVG content. These features are designed to make it easy to include and handle multimedia and graphical content on the web without having to resort to proprietary plugins and APIs. While some elements and attributes have been removed. Some elements, such as <a>, <cite> and >menu> have been changed, redefined or standardised. The APIs and DOM are no longer reconsiderations, but are fundamental parts of the HTML5 specification.
HTML5 also defines in some detail the required processing for invalid documents, so that syntax errors will be treated uniformly by all conforming browsers and other user agents.
</menu></cite></a></canvas></audio></video></nav></header></article></section>

Write short notes about HTML5?

HTML5 improves interoperability and reduces development costs by making precise rules on how to handle all HTML elements, and how to recover from errors.
Some of the new features in HTML5 are functions for embedding audio, video, graphics, client-side data storage, and interactive documents. HTML5 also contains new elements like <footer>, <header>, <nav>, and <figure>.
The HTML5 working group includes AOL, Apple, Google, IBM, Microsoft, Mozilla, Nokia, Opera, and many hundreds of other vendors.
</figure></nav></header></footer>

How to declare in HTML5?

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

What is < !DOCTYPE>? Is it necessary to use in HTML5?

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 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).
</html>

Write Minimal Code for HTML5 Document?

Below is a simple HTML5 document, with the minimum of required tags:
< !DOCTYPE html>
<html>
<head>
<title>Title of the document>/title>
</head>
<body>
The content of the document……
</body>
</html>

List out the new features of HTML5?

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
</section></nav></header></footer></article></audio></video></canvas>

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.

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 Silverlight, Apache Pivot, and Sun JavaFX.

What other advantages does HTML5 have?

• Cleaner markup
• Standardized approach to mobile devices support
• Additional semantics of new elements like <header>, <nav>, and <time>
• New form input types and attributes that will (and in Opera’s case, do) take the hassle out of scripting forms.
</time></nav></header>

What is the status of the development of the HTML 5 standard?

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.[1] As of March 2010[update], the specification is in the Draft Standard state at the WHATWG, and in Working Draft state at the W3C.

How many New Markup Elements you know in HTML5?

Below are the New Markup Elements added in HTML5
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
<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.
</wbr></time></section></rp></rt></ruby></progress></nav></meter></mark></h6></h1></hgroup></header></footer></figcaption></figure></summary></details></command></bdi></aside></article>

What are the New Media Elements in HTML5? Is canvas element used in HTML5?

Below are the New Media Elements have added in HTML5
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
<track> For text tracks used in mediaplayers
Yes we can use Canvas element in html5 like below
<canvas>
</canvas></track></embed></source></video></audio>

Do you know New Input Type Attribute in HTML5?

Yes we can use below new input type Attribute in HTML5
Type Value
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

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=”pcds.mp4″ type=”video/mp4″ />
<source src=”pcds.ogg” type=”video/ogg” />
</video>
And audie like this
<audio controls=”controls”>
<source src=”song.ogg” type=”audio/ogg” />
<source src=”song.mp3″ type=”audio/mpeg” />
</audio>

What the use of Canvas Element in HTML5?

The canvas element is used to draw graphics images on a web page by using javascript like below

 <canvas id=”pcdsCanvas” width=”500″ height=”400″></canvas>

<script type=”text/javascript”>
var pcdsCanvas=document.getElementById(“pcdsCanvas”);
var pcdsText=pcdsCanvas.getContext(“2d”);
pcdsText.fillStyle=”#82345c”;
pcdsText.fillRect(0,0,150,75);
</script>

What is the use of localStorage in HTML5?

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
<script type=”text/javascript”>
localStorage.name=”PCDS”;
document.write(localStorage.name);
</script>
<script type=”text/javascript”>
localStorage.address=”Mumbai India..”;
document.write(localStorage.address);
</script>

What is the sessionStorage Object in HTML? How to create and access?

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
<script type=”text/javascript”>
sessionStorage.name=”PCDS”;
document.write(sessionStorage.name);
</script>

HOW DO YOU PLAY A VIDEO USING HTML5?

We can display video using the tag as shown below:
1. <video width=“320″ height=“240″ controls=“controls”>
2. <source src=“test.mp4″ type=“video/mp4″ />
3. </video>

No comments:

Post a Comment