HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and current major version of the HTML standard. In this tutorial we are providing some set of frequently asked HTML5 interview Questions. Read PHP interview Questions and Answers.
What are the new features in HTML5?
Key new features of HTML5 include:
Improved support for embedding graphics, audio, and video content via the new canvas, audio, and video tags.
Introduction of “web workers”.
Several new semantic tags were also added to complement the structural logic of modern web applications. These include the main, nav, article, section, header, footer, and aside tags.
New form controls, such as calendar, date, time, email, url, and search.
Are HTML tags case sensitive?
What is the purpose of ‘placeholder’ attribute in HTML5?
HTML5 introduced a new attribute called placeholder. This attribute on input and textarea elements provides a hint to the user of what can be entered in the field. The placeholder text must not contain carriage returns or line-feeds.
What is the purpose of ‘autofocus’ attribute in HTML5?
What is the purpose of ‘required’ attribute in HTML5?
HTML5 introduced a new attribute called required which would insist to have a value in an input control.
What are the various elements provided by HTML 5 for media content?
audio and video elements are provided by HTML5 for media playback
The tags used are:
1) audio – It defines sound content.
2) video – It defines a video or a movie.
3) source – This tag defines the multiple media resources for video and audio.
4) embed – It provides a container for an external application or interactive content.
5) track – It defines text tracks for video and audio
What are the new Form elements made available in HTML5?
1) datalist – It specifies a list of options for input controls. These options are pre-defined.
2) keygen – This tag defines a key-pair generator field.
3) output – It defines the result of a calculation.
What are the various tags provided for better structuring in HTML5?
1) article – This tag defines an article.
2) aside – It defines content other than the page content.
3) bdi – This tag isolates a part of text for formatting in a different direction from other text.
4) command – It defines a command button to be invoked by the user.
5) details – It defines additional details that can be viewed or hidden by the user.
6) dialog – It defines a dialog box.
7) figure – This tag specifies content like illustrations, diagrams, photos, code listings, etc.
8) figcaption – It is used to provide a caption for a figure element
9) footer – This tag defines a footer for a document or section
10) header – This tag is used to define a header for a document or section
What is SVG?
SVG is the abbreviation for Scalable Vector Graphics and is recommended by W3C.
It is used to define vector-based graphics for the Web.
The graphics are defined in XML format.
What is a Canvas? What is the default border size of a canvas?
Canvas is a rectangular area on a HTML page, specified with the canvas tag.
By default, It has no border. To get a border style attribute can be used.
Differentiate between Canvas and SVG?
Canvas is resolution dependent while SVG is not.
Canvas does not provide any support for event handlers while SVG does provide the support for event handlers.
Canvas is suitable for graphic-intensive games while SVG is not suitable for gaming.
Canvas is suitable for small rendering areas while SVG is suitable for large rendering areas like Google maps.
HTML 5 provides drag and drop facility. How do you make an image draggable?
<img draggable="true" />
What is HTML5 Web Storage?
It store the data locally in the user’s browser
Differentiate between session Storage and local Storage objects?
Session Storage object stores the data only for one session while local Storage object stores the data without an expiry date.
What is a Manifest file?
A Manifest file is a simple text file that tells the browser what to cache and what not to cache.
What is a Web Worker?
A web worker is a script that runs in the background without the page needing to wait for it to complete. The user can continue to interact with the page while the web worker runs in the background. Workers utilize thread-like message passing to achieve parallelism.
What is the purpose of HTML5 versus XHTML?
HTML5 is the next version of HTML 4.01, XHTML 1.0 and DOM Level 2 HTML. Its aim to reduce the need for proprietary plug-in-based rich internet application (RIA) technologies such as Adobe Flash, Microsoft Silverlight etc.
What are some other advantages of HTML5?
Cleaner markup than earlier versions of HTML
Additional semantics of new elements like header, nav, and time
What is the !DOCTYPE? Is it mandatory to use in HTML5?
The !DOCTYPE is an instruction to the web browser about what version of HTML the page is written in. The !DOCTYPE tag does not have an end tag. It is not case sensitive.
What are the new input types provided by HTML 5 for forms?
1. color â€“ Used for fields that should contain colour.
2. date â€“ Allows the user to select a date.
3. datetime – Allows the user to select a date and time (with time zone).
4. datetime-local – Allows the user to select a date and time (without time zone).
5. email – Used for input fields that should contain an e-mail address.
6. month – Allows the user to select a month and year.
7. number – Used for input fields that should contain a numeric value. Restrictions on type of numbers accepted can be set.
8. range – Used for input fields that should contain a value from a range of numbers. Restrictions on type of numbers accepted can be set here as well.
9. search – Used for search fields.
10. tel – Defines a field for entering a telephone number.
11. time – Allows the user to select a time.
12. url – Used for input fields that should contain a URL address.
13. week – Allows the user to select a week and year.
How to link an email address?
<a href="mailto:email@example.com">Email Me</a>
What is the difference between span and div?
The difference is that span gives the output with display: inline and div gives the output with display: block.
span is used when we need our elements to be shown in a line, one after the other.
What is the Geolocation API in HTML5?
Today, most browsers and mobile devices support the Geolocation API. The Geolocation API works with a new property of the global navigator object.
A Geolocation object can be created as follows:
var geolocation = navigator.geolocation;
The geolocation object is a service object that allows widgets to retrieve information about the geographic location of the user’s device.
What’s one main result if you do not specify a doctype in an HTML page?
New HTML5-specific tags will not be interpreted by the browser.
What are the drawbacks of cookies?
Cookies have following drawbacks-
Cookies are included with every HTTP request, thereby slowing down your web application by transmitting the same data.
Cookies are included with every HTTP request, thereby sending data unencrypted over the internet.
Cookies are limited to about 4 KB of data . Not enough to store required data.
What do you mean by local storage in HTML5?
HTML5 introduces the localStorage attribute which would be used to access a page’s local storage area without no time limit and this local storage will be available whenever you would use that page.
When a local storage data gets deleted?
local storage data has no time limit. To clear a local storage setting you would need to call localStorage.remove(‘key’); where ‘key’ is the key of the value you want to remove. If you want to clear all settings, you need to call localStorage.clear() method.