Most Frequently Asked Question HTML5 Interview Questions with Answers

HTML5 is the latest version of the HTML language. HTML is stand for hypertext markup language, it is a universal World Wide Web(www) markup language that allows you to create and design web pages for viewing on the Internet.

HTML5, which was officially published in 2012, supports all existing web pages.

Que. What is HTML5?

HTML5 provides some standard features such as CSS, HTML, JavaScript and DOM, which in turn will reduce the need for external plug-ins. It is more marked to replace scripts, better error handling, etc. HTML5 is device independent.

Que. What is the difference between HTML and HTML5?

HTML5HTML
HTML5 has high-level video and audio support.High-level video and audio support is not a part of the version and specifications in the previous HTML.
Canvas, SVG and other virtual vector graphics are supported in HTML5.HTML, if we want to implement vector graphics, that was only possible by using third party library like VML, Silver-light
SVG and MathML can be used in text.Not posible in HTML
Web SQL database, application cache and web storage is used as a permanent storage.Browser cache can be used as a temporary storage.
HTML5 is more mobile friendly.HTML is less mobile friendly.
Doctype declaration is simple and easy.Doctype declaration is long and complicated
HTML5 Allows drag and drop effect.HTML Does not allow drag and drop effect.
HTML5 Attributes of Async, charset, and ping are available.HTML attributes are not available.
HTML5 support javascript to run in the background.Its not support javascript to run within the web browser.
In HTML5 We can draw shapes like rectangle, circle, and trianglenot possible to draw shapes like rectangle, circle, triangle etc. in HTML

Top HTML5 Interview Question

Que. What are the new tags in Media Elements in HTML5?

HTML5 new media tag elements:

<audio>: Request multimedia content such as sounds, audio streams or music, embed audio content without the need for any additional add-ons such as a flash player.

<video>: Request video content such as video streams or movie clips, embed video content, etc.

<source>: Request multiple multimedia resources in multimedia elements, such as audio, video, image, etc.

<embed>: Request an external application or embedded content (an add-on).

<track>: Request text clues in multimedia items, such as video or audio. This tag is used for subtitles or subtitle files while the video is playing.

Que. What is the importance of drag and drop in HTML5?

Drag and drop is the most important user interface concept that makes it easy to grab an object and drag it to the place you want with the help of a mouse click.

In this article if you want drag div using elements so you type  <div draggable = “true”>, to make div draggable and set the draggable div attribute to true.

HTML5 Interview Question PDF

Get the latest and most frequent questions and answers about the HTML5 interview for the experience

Que. Please tell HTML5 new Form input types name?

  • Date: It is a Date picker, you can pick a date by using input type = “date”.
  • Week: It is a Week picker,  You can pick a week by using input type = “week”.
  • Month: It is a Month picker, You can pick a month by using input type = “month”.
  • Time: It is a Time picker, You can pick the time by using input type = “time”.
  • Datetime: It is a combined date and time, you can pick the combination of date and time by using input type = “datetime”.
  • Datetime-local: It is a combined local date and time, You can pick the combination of local date and time using input type = “DateTime-local”.
  • Email: its Allow one or more Email Addresses, You can enter multiple email addresses using Input type = “email”.
  • Tel:  its Allow different phone numbers around the world. With a phone number is validated by the client-side. you can enter a phone number using input type = “tel”.
  • Search: it Allow to search your queries by input text. you can enter multiple your queries using input type = “search”.
  • Number: Its Allow inserting a numerical value with additional attributes such as min, max, You can enter multiple numerical values using input type = “number”.
  • Url: it is a url input type, that is used for the web address. In a single url, you can use multiple attributes using input type = “url”.
  • Color: Its Allow to select multiple colors, You can select multiple color using input type = “color”.
  • Range:Its allow to insert a numerical value within a specific range, Range is similar to the number but Range is much specific. you can enter a numerical value within a range using input type = “range”.
  • Placeholder: Its allow to display a short hint (usually in a light color) in the input fields, before we enter the value. you can write a short hint in the input field by using input type = “placeholder”.

HTML5 Questions

Que. What browsers are compatible with HTML5? Or Which browsers support HTML5?

The latest versions of Apple Safari, Google Chrome, Mozilla Firefox and Opera are compatible with many HTML5 features and Internet Explorer 9.0 will also be compatible with some HTML5 features.

Mobile web browsers that are preinstalled on iPhones, iPads and Android phones have excellent support for HTML5.

Que. How to optimize website assets?

Some basic optimization rules, to optimize website assets. Initially, we should decrease the download size and make fewer http requests.

  • File compression
  • File concatenation
  • CDN Hosting
  • Offloading assets
  • Re-organizing
  • Refining code

HTML5 Interview Question PDF Download

Get the latest and most frequent questions and answers about the HTML5 interview for the experience

Que. Why we use HTML5?

HTML5 supports animation, drawing, audio, video, etc. and easily embed a video on the website. It does not require any additional software like Flash to watch videos.

Some of the important reasons to use HTML5 are given below:

  • Legacy and cross-browser support
  • Better interactions
  • Smarter storage
  • Cleaner code

HTML5 Interview Question and Answer

Que. Explain The HTML5 Graphics?

HTML5 supports two types of graphics:

  1. Canvas
  2. SVG

Canvas: The <canvas> element is used to design graphics on the web page, and has several methods available to draw circles, frames, add images and text. 200px X 100px (width X height) is the default pixel size of the canvas.
Example:  

<canvas id = “mycanvas” width = “100” height = “100”></canvas>

SVG: <svg> Scalable vector graphics are mainly used for graphic applications and scalable vector type diagrams, such as the X, Y coordinate system, two-dimensional graphics and pie charts. This makes it faster and lighter. SVG follows the XML format.
Example:

<svg width = “400” height = “150”>
	<rect width = “400” height = “150” style = “fill:rgb(200,220,255);stroke-width:10;stroke:rgb(0,0,0)”/>
</svg>

Que. What video and audio formats are used to embed the web page?

It is used for embedding on the web page are given below:

  • Video: MPEG4, Ogg, WebM.
  • Audio: WAV, Ogg Vorbis, MP3.

Que. List the HTML5 page structure elements?

HTML5 page structure elements are given below:

<header>: it represents the section of the header and stores the initial information about the web page.
<footer>: it represents the footer section (last part) of the page.
<nav>: it represents the navigation elements of the HTML page.
<article>: it means set of information.
<section>: it means set of instructions that is used within the article block to define the basic structure of a page.
<sidebar>: it contents of the sidebar of the page.

Que. What are the tags migrated from HTML4 to HTML5?

HTML4HTML5
<div class=”header”><header>
<div class=”footer”><footer>
<div class=”menu”><nav>
<div class=”post”><article>
<div class=”content”><section>

Que. Explain the web storage in HTML5?

In this article HTML 5 data storage can be done in two ways:

  • Session storage: the details of the current session (that is, a user browsing the website) are stored. Once the user closes the browser, the storage is deleted.
  • Local storage: data stored in local storage will not be deleted automatically or when the user closes the browser.

Que. What is List the API’s available in HTML5?

They are below:

  • Constraint Validation API
  • Text Track API
  • Media API
  • Command API
  • User Interaction
  • Data Transfer API
  • History API
  • Application Cache API

Que. What are the rules set for HTML5?

Some rules for HTML5:

  • The new functions must be based on HTML, CSS, DOM and JavaScript
  • Reduce the need for external add-ons (such as Flash)
  • Better error handling
  • More brands to replace scripts
  • HTML5 must be device independent
  • The development process must be visible to the public.

Que. What is the difference between SVG and Canvas elements?

SVGCanvas
SVG is Object Model-based.It is pixel based.
SVG suitable for using large rendering areas.Is suitable for using small rendering areas.
SVG provides any support for event handlers.Canvas does not provide any recourse for event handlers.
Modification is allowed through script and CSS.Modification is allowed through script only.
SVG has Better scalability.Canvas has poor scalability.
SVG is Vector based (composed of shapes).Canvas is Raster based (composed of a pixel).
SVG is not suitable for Games graphics.Canvas is suitable for games graphics.
SVG does not depend on resolution.Canvas is completely dependent on resolution.
SVG is capable for API animation.Canvas has no any API for animation.
SVG is suitable for printing with high quality and any resolution.Canvas is not suitable for printing high quality and high resolution.

Bootstrap Interview Question PDF Download

Get the latest and most frequent questions and answers about the Bootstrap interview for the experience

Bootstrap 4 is the latest version of Bootstrap, which is the most popular HTML, CSS and JavaScript framework for developing responsive and mobile websites first. Bootstrap 4 is completely free to download and use!

Bootstrap 4 Source CSS files converted to SCSS.

Bootstrap 4 has 5 grid systems (.col-, .col-sm-3, .col-md-3, .col-lg-3, .col-xl-3). Bootstrap 4 has removed the x from the lowest break point. Therefore, (col-) covers all devices.

Bootstrap 4 has changed the offset class (offset-md-4)

Difference Between Bootstrap 4 and Bootstrap Image Responsive

Bootstrap 3 Image: .In Bootstrap 3 we are used this (.img-responsive) class for responsive image.
Bootstrap 4 Image: it has changes the class for responsive image (.img-fluid).

Bootstrap 4 Form Control

Bootstrap 4 has changed to (.form-control-lg) and (.form-control-sm) to increase and decrease the input size. Bootstrap 4 has add, delete and rename classes.

Why use Bootstrap 4?

  • It’s open source
  • Easy to get started
  • Great grid systems
  • Responsiveness
  • Mobile First
  • Consistency
  • Browser support

Using CDN

<!-- Compiled and Minified Bootstrap4 CSS -->
<link rel = "stylesheet" 
   href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
   integrity = "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" 
   crossorigin = "anonymous">

<!-- jQuery Library -->
<script src = "https://code.jquery.com/jquery-3.2.1.slim.min.js" 
   integrity = "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" 
   crossorigin = "anonymous">
</script>

<!-- Popper -->
<script src = "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" 
   integrity = "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" 
   crossorigin = "anonymous">
</script>

<!-- Compiled and Minified Bootstrap4 JavaScript -->
<script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" 
   integrity = "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" 
   crossorigin = "anonymous">
</script>
bootstrap 4

Bootstrap is an HTML, CSS and JS framework for creating rich web applications with minimal effort. This framework emphasizes more in the construction of mobile web applications.

In other word Bootstrap is a front-end framework that is used to create HTML, CSS and JS web applications. Its design is very sensitive, easy and quick to use.

It mainly focuses on creating a mobile application with design templates to create UI as drop-down menu, forms, buttons, alerts tab, etc.

Why Use Bootstrap?

  • Easy to use: Anyone with basic knowledge of HTML and CSS can start using Bootstrap
  • Responsive Features: Bootstrap’s responsive CSS adjusts on phones, tablets, and desktops
  • Mobile-first approach: In Bootstrap, mobile-first styles are part of the core framework
  • Browser Compatibility: Bootstrap is compatible with all modern browsers (Chrome, Firefox, Internet Explorer, Edge, Safari and Opera)

key components of Bootstrap.

  • Scaffolding: it has the grid system, background, styles/ link styles .
  • JS Add-ons and JavaScript Plugins : contains JS and jQuery add-ons and many jQuery and JavaScript plugins .
  • Customize: you can customize frames or To get your own version of framework .
  • CSS: contains CSS files or with plenty of CSS files .
what is Bootstrap
Bootstrap

Example: The following example shows the code of a basic bootstrap page

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example for You</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h1>My First Bootstrap Page Heading</h1>
  <p>This is paragraph text.</p>
</div>

</body>
</html>

Class– A class is a style (like a group of CSS attributes) that can be applied to one or more HTML elements. It is applied to an HTML element via the class attribute and the class name.

.example-class: {background: #000;}

ID– A ID selector is a name assigned to a specific style. It can be associated with one HTML element with the assigned ID. Within CSS, ID selectors are defined with the # character followed by the selector name.

#example-id: {background: #000;}

$(this) returns a jQuery object, on which you can call several jQuery methods e.g. text() to retrieve text, val() to retrieve value etc, while this represent current element, and it’s one of the JavaScript keyword to denote current DOM element in a context. You can not call jQuery method on this, until it’s wrapped using $() function i.e. $(this).

Example:

$(document).ready(function(){
    $('#DivValue').mouseover(function(){
       alert($(this).text());
  });
});

////**************////

$(document).ready(function(){
    $('#DivValue').mouseover(function(){
       alert(this.innerText);
  });
});

The difference between ID and class selector, It is same with jQuery. ID selector uses ID e.g. #element-id to select element, while class selector uses CSS class to select elements. When you just need to select only one element, use ID selector, while if you want to select a group of element, having same CSS class than use class selector.

  1. Easy to use and learn.
  2. Easily expandable.
  3. Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
  4. Easy to use for DOM manipulation and traversal.
  5. Large pool of built in methods.
  6. AJAX Capabilities.
  7. Methods for changing or applying CSS, creating animations.
  8. Event detection and handling.
  9. Tons of plug-ins for all kind of needs.

There are 10 important new form elements in HTML 5:

  1. Color
  2. Date
  3. Datetime-local
  4. Email
  5. Time
  6. URL
  7. Range
  8. Telephone
  9. Number
  10. Search

If you want to show color picker dialog box see bellow code:

<input type="color" name="favcolor">

If you want to show calendar dialog box see bellow code:

<input type="date" name="jurney">

If you want to show calendar with local time dialog box see bellow code:

<input type="datetime-local" name="jurneytime">  

If you want to create a HTML text with email see bellow code:

<input type="email" name="email"> 

If you want to set the type as “url” see bellow code:

<input type="url" name="websitename">

If you want to display textbox with number range you can set type to number see code:

<input type="number" name="quantity" min="1" max="5">

If you want to display a range control you can use type as range see code below.

<input type="range" min="0" max="10" step="2" value="5"> 

If you want to make search engine box.

<input type="search" name="google"> 

If you want to take time input:

<input type="time" name="user_time"> 

If you want to make text box to accept telephone numbers.

<input type="tel" name="my_teliphone">

Datalist element in HTML5 helps to provide autocomplete feature in a textbox as shown below.

Below is the HTML code for DataList:

<input list="Country">
<datalist id="Country">
 <option value="India">
 <option value="Italy">
 <option value="Iran">
 <option value="Israel">
 <option value="Indonesia"> 
</datalist>