Html interview question

 What is semantic HTML?

Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.

Difference between HTML4 and HTML5
HTML5’s Geolocation API lets users share their physical location with chosen web sites. JavaScript can capture a user’s latitude and longitude and can send it to the back-end web server to enable location-aware features like finding local businesses or showing their location on a map.
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 are the new features provided in HTML5?

Some of the new features provided in HTML5 are:

1. It provides support for local storage
2. New form controls, like calendar, date, time, email, url, search
3. <canvas> element is provided to facilitate 2D drawing
4. The <video> and <audio> elements are provided for media playback
5. New content-specific elements are provided. For e.g. <article>, <header>, <footer>, <nav>, <section>

Tell us something about the new <canvas> element.

- The new <canvas> element provided by HTML5 aids in 2D drawing.
- It uses the tag <canvas>.
- This tag helps in drawing graphics through scripting usually JavaScript.

What are the different kinds of Doctypes available?

The three kinds of Doctypes which are available:
  • Strict Doctype
  • Transitional Doctype
  • Frameset Doctype

What is SVG?

1. SVG is the abbreviation for Scalable Vector Graphics and is recommended by W3C.
2. It is used to define vector-based graphics for the Web.
3. The graphics are defined in XML format.
4. An important quality of SVG graphics is that their quality is maintained even when they are zoomed or resized.
5. All the element and attributes of SVG files can be animated.

What are the various elements provided by HTML5 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?

The new Form elements in HTML5 provide for a better functionality. The tags provided to carry out these functions are:

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 is the best way to group form elements?

The <fieldset> tag can be used to group some of the form elements. When the purpose is to provide some HTML elements as a group to the user then, fieldset tag is the best one to use. It takes another tag in it <legend> which provides a title to the grouped elements.

  • Session Storage: The current session (i.e., a user who is browsing the website) details are stored. Once the user closes the browser, the storage is cleared.
  • Local Storage: Data stored in local storage will not be cleared automatically or when the user closes the browser.

 List few input type attributes that are new in HTML5.

An input tag can take some attributes based on the requirement. ie <input type=”text”> creates a textbox that takes text/number/special characters into it. The attribute type can take more values, these are:
  • Datetime: Gives a datetime accepted textbox.
  • Placeholder: Places an editable text in the textbox.
  • Number: Takes only numbers and no text and special characters.
  • Tel: Takes inputs like a telephone number.
  • Email: Takes text with email format.

what is meta tag?
The HTML <meta> tag is used for declaring metadata for the HTML document.
Metadata can include document decription, keywords, author etc. It can also be used to refresh the page or set cookies.

The meta tag is placed between the opening/closing <head> </head> tags.


What is the use of figure tag in HTML 5?

The figure tag is used to add a photo in the document on the web page. It is used to handle the group of diagrams, photos, code listing with some embedded content.
  1. <p>The Taj Mahal is widely recognized as "the jewel of Muslim art in India and one of the universally admired masterpieces of the world's heritage."</p>    
  2. <figure>    
  3.   <img src="htmlpages/images/tajmahal.jpg" alt="Taj Mahal"/>    
  4. </figure>     

28) Does a <!DOCTYPE html> tag is a HTML tag?

No, the <!DOCTYPE html> declaration is not an HTML tag. There are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. So, <!DOCTYPE html> is used to instruct the web browser about the HTML page.

DOCTYPE or Document Type Declaration is a type of instruction which usually works in association with particular SGML or XML documents basically. Let us take an example to understand it more thoroughly, for example, A Web page with a document type definition i.e. DTD is the best to understand. In a well serialized and a proper form of the document, It manifests and also the contribution of it is a lot as a short string of markup that usually conforms to a particular syntax.

What is “Semantic HTML” ?

Semantic HTML or Semantic Markup is HTML that introduces meaning to the web page rather than just presentation.
<form><table>, and <article> are examples of Semantic Elements.
Below are the list of few new Semantic Elements introducted HTML5
  • <article>
  • <aside>
  • <details>
  • <figcaption>
  • <figure>
  • <footer>
  • <header>
  • <main>
  • <mark>
  • <nav>
  • <section>
  • <summary>
  • <time>

 What is SVG?

HTML SVG is used to describe the two-dimensional vector and vector/raster graphics. SVG images and their behaviors are defined in XML text files. So as XML files, you can create and edit an SVG image with the text editor. It is mostly used for vector type diagrams like pie charts, 2-Dimensional graphs in an X, Y coordinate system.
  1. <svg width="100" height="100">    
  2.  <circle cx="50" cy="50" r="40" stroke="yellow" stroke-width="4" fill="red" />    
  3. </svg>   

Which are limitations of AJAX?

- Back functionality can’t work because the dynamic pages won’t register themselves to the browsers cache. Hence the use Iframe will become required.
- The page cannot be bookmarked if it is developed using Ajax.
- If java script is not enabled, Ajax will stop working.
- Because different components of the pages are loaded at different times, response time may be slow.
- Because different components of the pages are loaded at different times it may create confusion for the user.

What is the difference between synchronous postback and asynchronous postback?

The difference between synchronous and asynchronous postback is as follows:

- Asynchronous postback renders only the part of the page which is needed; while, synchronous postback renders the entire page in a postback.
- Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions are executed one by one; while, - synchronous postback invoke all the actions at a time.
- Asynchronous postback only changes the update panel that invoke the postback; while, synchronous postback changes the entire page.

What is the difference between DIV and SPAN in HTML?

The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.
<div id="scissors">
    <p>This is <span class="paper">crazy</span></p>
</div>

What is the canvas element in HTML5?

The <canvas> element is a container that is used to draw graphics on the web page using scripting language like JavaScript. It allows for dynamic and scriptable rendering of 2D shapes and bitmap images. There are several methods in canvas to draw paths, boxes, circles, text and add images. For Example:
  1. <canvas id="myCanvas1" width="300" height="100" style="border:2px solid;">    
  2. Your browser does not support the HTML5 canvas tag.    
  3. </canvas>    

Comments

Popular Posts